summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doas.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/doas.c b/doas.c
index 2cd227d..d348d25 100644
--- a/doas.c
+++ b/doas.c
@@ -273,6 +273,11 @@ main(int argc, char **argv)
const char *cwd;
char **envp;
+ if (argc <= 0 || argv == NULL || argv[0] == NULL) {
+ fprintf(stderr, "doas: executed without argv\n");
+ exit(1);
+ }
+
setprogname("doas");
closefrom(STDERR_FILENO + 1);