Re: Changing argv[0] under Linux.

From: Mark Mielke (mark@mark.mielke.cc)
Date: Tue Jan 14 2003 - 23:46:44 EST


On Tue, Jan 14, 2003 at 03:11:41PM -0800, Bob Miller wrote:
> On Tue, Jan 14, 2003 at 03:04:18PM -0800, Bob Miller wrote:
> > 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.
> In thinking about this more this will NOT work. The user stack starts
> right after your envp. So, writing more info there would blow away
> your stack.

I can smell the next hack... memmove() the stack down to make room... :-)

mark

-- 
mark@mielke.cc/markm@ncf.ca/markm@nortelnetworks.com __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

One ring to rule them all, one ring to find them, one ring to bring them all and in the darkness bind them...

http://mark.mielke.cc/

- 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:53 EST