Mercurial > hg > toybox
changeset 373:5e68c7cab1a4
Make toy_init() reentrant, or else xexec() has funky errors.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 06 Jan 2010 05:29:17 -0600 |
parents | 9051cb744d0a |
children | 633a5bf9509d |
files | main.c |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Wed Jan 06 05:28:32 2010 -0600 +++ b/main.c Wed Jan 06 05:29:17 2010 -0600 @@ -76,10 +76,12 @@ if ((which->flags & TOYFLAG_NEEDROOT) && euid) error_exit("Not root"); - } - // Free old toys contents here? + // Free old toys contents (to be reentrant) + + if (toys.optargs != toys.argv+1) free(toys.optargs); + bzero(&toys, sizeof(struct toy_context)); toys.which = which; toys.argv = argv;