diff options
author | noneofyourbusiness <noneofyourbusiness@localhost> | 2022-09-26 12:07:43 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-07-02 11:47:35 +0200 |
commit | e6e58c96802d6611c9b4f25025a800dd4e0b75a3 (patch) | |
tree | 2c17692002ae312d8c3fc7a13809829b1cff67c3 | |
parent | Assume libc (correctly) does not define union semun (diff) | |
download | bus-e6e58c96802d6611c9b4f25025a800dd4e0b75a3.tar.gz bus-e6e58c96802d6611c9b4f25025a800dd4e0b75a3.tar.bz2 bus-e6e58c96802d6611c9b4f25025a800dd4e0b75a3.tar.xz |
libbus.c: handle fopen() errors in bus_open
Diffstat (limited to '')
-rw-r--r-- | libbus.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -670,6 +670,10 @@ bus_open(bus_t *restrict bus, const char *restrict file, int flags) f = fopen(file, "r"); + if (f == NULL) { + goto fail; + } + t(getline(&line, &len, f)); t(bus->key_sem = (key_t)atoll(line)); free(line), line = NULL, len = 0; @@ -684,6 +688,7 @@ bus_open(bus_t *restrict bus, const char *restrict file, int flags) t(open_semaphores(bus)); t(open_shared_memory(bus, flags)); } + return 0; fail: saved_errno = errno; |