summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2011-04-25 10:08:34 +0000
committerjilles <jilles@FreeBSD.org>2011-04-25 10:08:34 +0000
commit54847e6220f3c2d8ee228890b20ced5023a7fcf6 (patch)
tree417ea9d9aa041f6ee140c8854d7c89e5f9037e68 /bin
parentfb17b0c5f9968b2050e2c1e271c86eecd808810c (diff)
downloadFreeBSD-src-54847e6220f3c2d8ee228890b20ced5023a7fcf6.zip
FreeBSD-src-54847e6220f3c2d8ee228890b20ced5023a7fcf6.tar.gz
sh: Remove duplicate code resetting uid/gid for set +p/+o privileged.
MFC after: 1 week
Diffstat (limited to 'bin')
-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