Re: Changing argv[0] under Linux.
Dorin Lazar (lazar@deuromedia.ro)
Thu, 16 Jan 2003 11:19:35 +0200
On Thursday 16 January 2003 00:03, DervishD wrote:
> Yes, I suppose that exec'ing whatever is in argv0 is not a good
> idea :((( Didn't think about it.
> Any suggestion on how to get the binary name from the core image?
Does it have to be an exec?
Perhaps something like this:
int main(int argc, char **argv)
{
if (fork ()) {
strcpy (argv[0], "Fake name 00001");
setpgrp (); /* very important when dealing with stuff like this */
pause(); /* code for personality "Fake name 00001" */
return 0;
}
strcpy (argv[0], "Fake name 00002");
setpgrp ();
pause(); /* code for personality "Fake name 00002" */
}
this thing works - at least on my box...
But, of course, I could be mistaken, and I miss to see some other
important details. Good luck.
Dorin.
--
Dorin "sp00ky" Lazar, programmer
Registered Linux user #162515
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/