aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Zhukov <zhuk@openbsd.org>2015-07-22 16:35:03 +0000
committerVadim Zhukov <zhuk@openbsd.org>2015-07-22 16:35:03 +0000
commita2614ebbd28ea611e48596589f90c87ab60bf4d2 (patch)
treec12d03a16e1eeaa0d6238d59618ce97b14a1ff1b
parentfec01c17ec1cde1df449f76e5bda10e7afae2e05 (diff)
downloadopendoas-a2614ebbd28ea611e48596589f90c87ab60bf4d2.tar.gz
Small tweaks:
- whitespace on empty line; - use getuid() consistently. okay tedu@
-rw-r--r--doas.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/doas.c b/doas.c
index 0debb24..004076c 100644
--- a/doas.c
+++ b/doas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: doas.c,v 1.18 2015/07/21 17:49:33 jmc Exp $ */
+/* $OpenBSD: doas.c,v 1.19 2015/07/22 05:37:23 deraadt Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -214,7 +214,7 @@ copyenv(const char **oldenvp, struct rule *rule)
int ei;
int nsafe, nbad;
int nextras = 0;
-
+
nbad = arraylen(badset);
if ((rule->options & KEEPENV) && !rule->envlist) {
size_t i, ii;
@@ -294,11 +294,11 @@ main(int argc, char **argv, char **envp)
int i, ch;
int sflag = 0;
+ uid = getuid();
while ((ch = getopt(argc, argv, "C:su:")) != -1) {
switch (ch) {
case 'C':
- target = getuid();
- setresuid(target, target, target);
+ setresuid(uid, uid, uid);
parseconfig(optarg);
exit(0);
case 'u':
@@ -321,7 +321,6 @@ main(int argc, char **argv, char **envp)
parseconfig("/etc/doas.conf");
- uid = getuid();
pw = getpwuid(uid);
if (!pw)
err(1, "getpwuid failed");