diff options
author | dzwdz | 2022-09-03 23:49:58 +0200 |
---|---|---|
committer | dzwdz | 2022-09-03 23:49:58 +0200 |
commit | 014edc8e1df0e5070f974367a1b3b4462354410e (patch) | |
tree | 5ea8b637a2f114d44ec8a264dddd0bf9a9a8a779 /src | |
parent | d73c5ac9891ea3a88fa6a5ec1339df1f5cdf1a49 (diff) |
user/whitelist: when a command isn't given, default to a shell
Diffstat (limited to 'src')
-rw-r--r-- | src/user/app/shell/builtins.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/user/app/shell/builtins.c b/src/user/app/shell/builtins.c index 0f0125c..0098773 100644 --- a/src/user/app/shell/builtins.c +++ b/src/user/app/shell/builtins.c @@ -234,17 +234,19 @@ static void cmd_touch(int argc, char **argv) { static void cmd_whitelist(int argc, char **argv) { int split = 1; - for (;;) { - if (split >= argc) { - eprintf("no command"); - return; - } + for (; split < argc;) { if (!strcmp("--", argv[split])) break; split++; } argv[split] = NULL; MOUNT_AT("/") { fs_whitelist((void*)&argv[1]); } - run_args(argc - split - 1, &argv[split + 1], NULL); + + if (split < argc) { + run_args(argc - split - 1, &argv[split + 1], NULL); + } else { + const char **argv = (const char*[]){"shell", NULL}; + run_args(1, (void*)argv, NULL); + } } struct builtin builtins[] = { |