]> git.armaanb.net Git - opendoas.git/blobdiff - doas.c
Fix keepenv handling. Initially reported by Ze Loff on misc@.
[opendoas.git] / doas.c
diff --git a/doas.c b/doas.c
index 93b79c712865c50bbc012a5ef4a26bc946f48fed..91b3f68f357de0572eb0b2588446d6b899c684b4 100644 (file)
--- a/doas.c
+++ b/doas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: doas.c,v 1.25 2015/07/26 19:49:11 zhuk Exp $ */
+/* $OpenBSD: doas.c,v 1.28 2015/07/27 15:38:11 espie Exp $ */
 /*
  * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
  *
@@ -36,7 +36,7 @@
 static void __dead
 usage(void)
 {
-       fprintf(stderr, "usage: doas [-s] [-C config] [-u user] command [args]\n");
+       fprintf(stderr, "usage: doas [-ns] [-C config] [-u user] command [args]\n");
        exit(1);
 }
 
@@ -256,8 +256,10 @@ copyenv(const char **oldenvp, struct rule *rule)
                        size_t j;
                        for (j = 0; j < nextras; j++) {
                                if (strcmp(extra[j], safeset[i]) == 0) {
-                                       extra[j--] = extra[nextras--];
+                                       nextras--;
+                                       extra[j] = extra[nextras];
                                        extra[nextras] = NULL;
+                                       j--;
                                }
                        }
                }
@@ -282,7 +284,7 @@ fail(void)
        exit(1);
 }
 
-static int
+static void __dead
 checkconfig(const char *confpath, int argc, char **argv,
     uid_t uid, gid_t *groups, int ngroups, uid_t target)
 {