diff options
author | Lieuwe Rooijakkers <lieuwerooijakkers@gmail.com> | 2024-07-13 22:19:44 +0200 |
---|---|---|
committer | Lieuwe Rooijakkers <lieuwerooijakkers@gmail.com> | 2024-07-13 22:19:44 +0200 |
commit | be8ba89d09ada245e458ae006f477ff720d21fd1 (patch) | |
tree | ffb948e00941c2a7bc3f1c9442daf3a8f9fff10c /src | |
parent | 57c7abbd3c3b30086a5503a8017748caaf47084c (diff) |
kat, tak: handle open_map errors
Diffstat (limited to 'src')
-rw-r--r-- | src/kat.c | 3 | ||||
-rw-r--r-- | src/tak.c | 3 |
2 files changed, 6 insertions, 0 deletions
@@ -19,6 +19,9 @@ int entry_kat(int argc, char **argv) { for (int i = 1; i < argc; i++) { const char *fname = argv[i]; struct map *map = open_map(fname); + if (map == NULL) { + return 1; + } for (size_t i = 0; i < map->sb.st_size; i++) { putchar(map->addr[i]); @@ -19,6 +19,9 @@ int entry_tak(int argc, char **argv) { for (int i = argc-1; i >= 1; i--) { const char *fname = argv[i]; struct map *map = open_map(fname); + if (map == NULL) { + return 1; + } char *lstart, *lend; lend = &map->addr[map->sb.st_size - 1]; |