commit | db037ef6e0d7e84e5fd9ba831b55550a9b487257 | [log] [tgz] |
---|---|---|
author | Rob Landley <rob@landley.net> | Wed Jan 06 05:29:17 2010 -0600 |
committer | Rob Landley <rob@landley.net> | Wed Jan 06 05:29:17 2010 -0600 |
tree | 712d79a013ddf182852f4d68201c9289c815fcc5 | |
parent | 7051a963b0f646f0b489dba892d85e4816d95d79 [diff] [blame] |
Make toy_init() reentrant, or else xexec() has funky errors.
diff --git a/main.c b/main.c index e0dab1c..4b4b376 100644 --- a/main.c +++ b/main.c
@@ -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;