diff options
author | dzwdz | 2021-10-21 06:21:34 +0000 |
---|---|---|
committer | dzwdz | 2021-10-21 06:21:34 +0000 |
commit | d026ce97b8faaa2f3f196281b96df0a04e30e4f9 (patch) | |
tree | e18b6e0b7ddd58657d0e606124eeb5561e4794a9 /src/init/shell.c | |
parent | c0903edc3ee1fe4dd9c9921f4b7712a94271f238 (diff) |
init/shell: fix crash when cat is ran without arguments
Diffstat (limited to 'src/init/shell.c')
-rw-r--r-- | src/init/shell.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/init/shell.c b/src/init/shell.c index 53ad995..33f6da3 100644 --- a/src/init/shell.c +++ b/src/init/shell.c @@ -44,10 +44,13 @@ static int readline(char *buf, size_t max) { } static void cmd_cat(const char *args) { - int fd = _syscall_open(args, strlen(args)); + int fd; static char buf[256]; int len = 256; + if (!args) return; // no argument + + fd = _syscall_open(args, strlen(args)); if (fd < 0) { printf("couldn't open.\n"); return; |