Re: Changing argv[0] under Linux.

From: Dorin Lazar (
Date: Thu Jan 16 2003 - 04:19:35 EST

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 "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 More majordomo info at Please read the FAQ at

This archive was generated by hypermail 2b29 : Thu Jan 23 2003 - 22:00:12 EST