diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-02-22 23:13:31 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-02-23 10:10:48 +0900 |
commit | 70f1280c83ce4cc9f11fa99f1386cdf621e70ee4 (patch) | |
tree | 327acb1e20c39d4e7daa3daaf11fe34d4efb42b5 /src/libsystemd/sd-device | |
parent | a90d9ee1620ce65ecf07224f2d2d16f9f5c48ca9 (diff) | |
download | systemd-70f1280c83ce4cc9f11fa99f1386cdf621e70ee4.tar.gz |
tree-wide: use unlink_and_freep() moreover
Diffstat (limited to 'src/libsystemd/sd-device')
-rw-r--r-- | src/libsystemd/sd-device/device-private.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c index 182c4d66ff..e9d54f514e 100644 --- a/src/libsystemd/sd-device/device-private.c +++ b/src/libsystemd/sd-device/device-private.c @@ -794,7 +794,7 @@ int device_update_db(sd_device *device) { const char *id; char *path; _cleanup_fclose_ FILE *f = NULL; - _cleanup_free_ char *path_tmp = NULL; + _cleanup_(unlink_and_freep) char *path_tmp = NULL; bool has_info; int r; @@ -871,6 +871,8 @@ int device_update_db(sd_device *device) { goto fail; } + path_tmp = mfree(path_tmp); + log_device_debug(device, "sd-device: Created %s file '%s' for '%s'", has_info ? "db" : "empty", path, device->devpath); @@ -878,7 +880,6 @@ int device_update_db(sd_device *device) { fail: (void) unlink(path); - (void) unlink(path_tmp); return log_device_debug_errno(device, r, "sd-device: Failed to create %s file '%s' for '%s'", has_info ? "db" : "empty", path, device->devpath); } |