Changing argv[0] under Linux. This MUST work...

From: DervishD (raul@pleyades.net)
Date: Wed Jan 15 2003 - 12:36:56 EST


    Hi Jakob :)

    Your solution of exec'ing ourselves MUST undoubtly work (well, I
know that this an affirmation that I will lament XDDDD), because it
only relies on 'exec()' passing the argv[0] you provide as the
argv[0] of the invoked binary, and that should work or programs like
'/bin/login' will stop working... They rely on the same principle,
since they need to prepend an '-' to the shell name to make it a
login shell :))) Didn't remember this until now!

    So, if you do 'execl(ourselves, "my new name", ..., NULL)', the
argv[0] received by the binary specified in 'ourselves' MUST be 'my
new name'. Otherwise '/bin/login' and a good bunch of shells won't
work...

    If you happen to come to Spain at any point in the future, just
tell me, I'll buy you a beer (or crack, or whatever you use XDDD).

    Thanks :)

    Raśl
-
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/



This archive was generated by hypermail 2b29 : Wed Jan 15 2003 - 22:00:55 EST