lkml.org 
[lkml]   [2003]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Changing argv[0] under Linux.
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.070 / U:2.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site