lkml.org 
[lkml]   [2003]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Changing argv[0] under Linux.
On Tue, Jan 14, 2003 at 11:04:01PM +0100, DervishD wrote:
> Hi Philippe :)
>
> > You just overwrote all your arguments (argv[0] and others) and part of
> > the environment.
>
> Oh, sh*t, you're true, and that is the problem I was afraid to
> suffer from. Then, all I can do is overwrite argv[0] with a new
> string whose length is less or equal than the existing one.
>
> Well, I suppose I must go with that limitation.
>
> Thanks, Philippe, for the code snipped and the explanation.
>
> Raúl
> -

Or you can copy your all your args and env to a temporary place and
then re-build your args and env with the new argv[0] in it's place.
But you must be carefull that your new argv[0] length plus the
length of all remaining args, envp and pointers is not greater than
the system defined size for this space.

--
Bob Miller Email: rem@osdl.org
Open Source Development Lab Phone: 503.626.2455 Ext. 17
-
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.114 / U:1.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site