summaryrefslogtreecommitdiffstats
path: root/bin/sh/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/options.c')
-rw-r--r--bin/sh/options.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/bin/sh/options.c b/bin/sh/options.c
index de1f3ff..d44e345 100644
--- a/bin/sh/options.c
+++ b/bin/sh/options.c
@@ -198,13 +198,8 @@ options(int cmdline)
minus_o(*argptr, val);
if (*argptr)
argptr++;
- } else {
- if (c == 'p' && !val && privileged) {
- (void) setuid(getuid());
- (void) setgid(getgid());
- }
+ } else
setoption(c, val);
- }
}
}
return;
@@ -271,10 +266,6 @@ minus_o(char *name, int val)
} else {
for (i = 0; i < NOPTS; i++)
if (equal(name, optlist[i].name)) {
- if (!val && privileged && equal(name, "privileged")) {
- (void) setuid(getuid());
- (void) setgid(getgid());
- }
setoption(optlist[i].letter, val);
return;
}
@@ -288,6 +279,10 @@ setoption(int flag, int val)
{
int i;
+ if (flag == 'p' && !val && privileged) {
+ (void) setuid(getuid());
+ (void) setgid(getgid());
+ }
for (i = 0; i < NOPTS; i++)
if (optlist[i].letter == flag) {
optlist[i].val = val;
OpenPOWER on IntegriCloud