aboutsummaryrefslogtreecommitdiff
path: root/toys.h
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-01-30 16:28:13 -0600
committerRob Landley <rob@landley.net>2016-01-30 16:28:13 -0600
commitca311f1a41a579a57076adfeb2cc08b20dbca21a (patch)
tree464d3d1daba831016cdd4ac17f0996706e7cd229 /toys.h
parent4a13ca98e18cea4acc8d605653d0ee8425e34f59 (diff)
downloadtoybox-ca311f1a41a579a57076adfeb2cc08b20dbca21a.tar.gz
Fix two CFG_TOYBOX_SUID corner cases:
1) Don't try to force re-exec unless we actually dropped permissions. (Fixes "./toybox mount" when no suid bit on toybox binary, which previously exited.) 2) Set temporary toys.which value for error reporting. (Fixes "ln -s toybox mount && ./mount" with CFG_TOYBOX_DEBUG and no suid bit, which previously segfaulted.)
Diffstat (limited to 'toys.h')
-rw-r--r--toys.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/toys.h b/toys.h
index 8bd3be27..4bfccb15 100644
--- a/toys.h
+++ b/toys.h
@@ -127,13 +127,14 @@ extern struct toy_context {
int exitval; // Value error_exit feeds to exit()
int optc; // Count of optargs
int old_umask; // Old umask preserved by TOYFLAG_UMASK
- int toycount; // Total number of commands in this build
- int signal; // generic_signal() records what signal it saw here
+ short toycount; // Total number of commands in this build
+ short signal; // generic_signal() records what signal it saw here
int signalfd; // and writes signal to this fd, if set
+ int wasroot; // dropped setuid
// This is at the end so toy_init() doesn't zero it.
jmp_buf *rebound; // longjmp here instead of exit when do_rebound set
- void *stacktop; // nested toy_exec() call count, or -1 if vforked
+ void *stacktop; // nested toy_exec() call count, or 0 if vforked
} toys;
// Two big temporary buffers: one for use by commands, one for library functions