lkml.org 
[lkml]   [2003]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Changing argv[0] under Linux.
    Hi Miquel :))

> >Last time I checked argv[0] was 512 bytes. Many daemons overwrite
> >it with no problem.
> No cigar. This stuff is all set up by the kernel on the stack;

Thanks a lot for your help :)) FYI, this question is related to
the virtual-console-only init clone that I wrote some time ago (I
used sysvinit for inspiration and good advice), I think I wrote you
about this. Anyway, you are in the acknowledgement list doubly, now
;))) I'm going to release this init in a week or so, after having
using it for more than a year at home without problems.

> If you want to modify argv[0] etc, loop over argv[], count howmuch
> space there is (strlen(argv[0] + 1 + strlen(argv[1] + 1 ... etc)
> and make sure you do NOT write a string longer than that. Also
> make sure that you end the string with a double \0

How about portability? Not that worries me, since this code will
go to a Linux-only program, just curiosity. Other OSes do the same
stack layout?

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/

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