diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-03-27 14:36:36 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-03-27 18:09:56 +0100 |
commit | 6990fb6bc6f9421a15a3e0b02909b7526cd4cbfc (patch) | |
tree | db2aeb45c8616b52c10f616de5bfc27462add82c | |
parent | 36dbf9717030d0a9d69df2e6180284834fa8a851 (diff) | |
download | systemd-6990fb6bc6f9421a15a3e0b02909b7526cd4cbfc.tar.gz systemd-6990fb6bc6f9421a15a3e0b02909b7526cd4cbfc.tar.bz2 systemd-6990fb6bc6f9421a15a3e0b02909b7526cd4cbfc.zip |
tree-wide: (void)ify a few unlink() and rmdir()
Let's be helpful to static analyzers which care about whether we
knowingly ignore return values. We do in these cases, since they are
usually part of error paths.
-rw-r--r-- | src/backlight/backlight.c | 2 | ||||
-rw-r--r-- | src/core/namespace.c | 4 | ||||
-rw-r--r-- | src/coredump/coredumpctl.c | 4 | ||||
-rw-r--r-- | src/import/import-raw.c | 2 | ||||
-rw-r--r-- | src/import/pull-raw.c | 6 | ||||
-rw-r--r-- | src/journal-remote/journal-upload.c | 2 | ||||
-rw-r--r-- | src/journal/journalctl.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-hwdb/hwdb-util.c | 2 | ||||
-rw-r--r-- | src/login/logind-inhibit.c | 6 | ||||
-rw-r--r-- | src/network/networkd-link.c | 4 | ||||
-rw-r--r-- | src/sysusers/sysusers.c | 2 |
11 files changed, 18 insertions, 18 deletions
diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c index 28a1a903d1..dfd6805398 100644 --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c @@ -412,7 +412,7 @@ static int run(int argc, char *argv[]) { const char *value; if (validate_device(device) == 0) { - unlink(saved); + (void) unlink(saved); return 0; } diff --git a/src/core/namespace.c b/src/core/namespace.c index dfa3c160c1..8475145f06 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -1674,8 +1674,8 @@ int setup_tmp_dirs(const char *id, char **tmp_dir, char **var_tmp_dir) { char *t; t = strjoina(a, "/tmp"); - rmdir(t); - rmdir(a); + (void) rmdir(t); + (void) rmdir(a); free(a); return r; diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index fbee242962..b239d81945 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -859,7 +859,7 @@ static int save_core(sd_journal *j, FILE *file, char **path, bool *unlink_temp) error: if (temp) { - unlink(temp); + (void) unlink(temp); log_debug("Removed temporary file %s", temp); } return r; @@ -985,7 +985,7 @@ finish: if (unlink_path) { log_debug("Removed temporary file %s", path); - unlink(path); + (void) unlink(path); } return r; diff --git a/src/import/import-raw.c b/src/import/import-raw.c index 56f3431a08..b905832603 100644 --- a/src/import/import-raw.c +++ b/src/import/import-raw.c @@ -183,7 +183,7 @@ static int raw_import_maybe_convert_qcow2(RawImport *i) { r = qcow2_convert(i->output_fd, converted_fd); if (r < 0) { - unlink(t); + (void) unlink(t); return log_error_errno(r, "Failed to convert qcow2 image: %m"); } diff --git a/src/import/pull-raw.c b/src/import/pull-raw.c index 72b9054e49..691de8b275 100644 --- a/src/import/pull-raw.c +++ b/src/import/pull-raw.c @@ -250,7 +250,7 @@ static int raw_pull_maybe_convert_qcow2(RawPull *i) { r = qcow2_convert(i->raw_job->disk_fd, converted_fd); if (r < 0) { - unlink(t); + (void) unlink(t); return log_error_errno(r, "Failed to convert qcow2 image: %m"); } @@ -364,7 +364,7 @@ static int raw_pull_make_local_copy(RawPull *i) { r = copy_bytes(i->raw_job->disk_fd, dfd, (uint64_t) -1, COPY_REFLINK); if (r < 0) { - unlink(tp); + (void) unlink(tp); return log_error_errno(r, "Failed to make writable copy of image: %m"); } @@ -376,7 +376,7 @@ static int raw_pull_make_local_copy(RawPull *i) { r = rename(tp, p); if (r < 0) { r = log_error_errno(errno, "Failed to move writable image into place: %m"); - unlink(tp); + (void) unlink(tp); return r; } diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index ef3556f825..cc96825288 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -106,7 +106,7 @@ static int check_cursor_updating(Uploader *u) { if (r < 0) return log_error_errno(r, "Cannot save state to %s: %m", u->state_file); - unlink(temp_path); + (void) unlink(temp_path); return 0; } diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 42fb25cc46..00489098ee 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -1841,7 +1841,7 @@ finish: safe_close(fd); if (k) { - unlink(k); + (void) unlink(k); free(k); } diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c index 2ac4b59ad7..c83575c7c8 100644 --- a/src/libsystemd/sd-hwdb/hwdb-util.c +++ b/src/libsystemd/sd-hwdb/hwdb-util.c @@ -434,7 +434,7 @@ static int trie_store(struct trie *trie, const char *filename, bool compat) { error_fclose: r = -errno; fclose(t.f); - unlink(filename_tmp); + (void) unlink(filename_tmp); return r; } diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index 1bee58db12..d427dcaa01 100644 --- a/src/login/logind-inhibit.c +++ b/src/login/logind-inhibit.c @@ -59,7 +59,7 @@ void inhibitor_free(Inhibitor *i) { free(i->why); if (i->state_file) { - unlink(i->state_file); + (void) unlink(i->state_file); free(i->state_file); } @@ -173,7 +173,7 @@ int inhibitor_stop(Inhibitor *i) { inhibit_mode_to_string(i->mode)); if (i->state_file) - unlink(i->state_file); + (void) unlink(i->state_file); i->started = false; @@ -320,7 +320,7 @@ void inhibitor_remove_fifo(Inhibitor *i) { i->fifo_fd = safe_close(i->fifo_fd); if (i->fifo_path) { - unlink(i->fifo_path); + (void) unlink(i->fifo_path); i->fifo_path = mfree(i->fifo_path); } } diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 752fcd56b1..3e334c8d29 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -4018,7 +4018,7 @@ int link_save(Link *link) { assert(link->manager); if (link->state == LINK_STATE_LINGER) { - unlink(link->state_file); + (void) unlink(link->state_file); return 0; } @@ -4287,7 +4287,7 @@ int link_save(Link *link) { "DHCP_LEASE=%s\n", link->lease_file); } else - unlink(link->lease_file); + (void) unlink(link->lease_file); if (link->ipv4ll) { struct in_addr address; diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index df28bcfd72..b9fa334858 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -244,7 +244,7 @@ static int make_backup(const char *target, const char *x) { return 0; fail: - unlink(temp); + (void) unlink(temp); return r; } |