From: Yu Watanabe Date: Tue, 8 Mar 2022 05:24:48 +0000 (+0900) Subject: sd-device: shorten code a bit X-Git-Tag: v251-rc1~119 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=827f86506391acbc9ba3278d319fca1ab8fee70e;p=thirdparty%2Fsystemd.git sd-device: shorten code a bit --- diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c index 8eb7198808c..c383833740e 100644 --- a/src/libsystemd/sd-device/device-private.c +++ b/src/libsystemd/sd-device/device-private.c @@ -1029,18 +1029,9 @@ int device_update_db(sd_device *device) { * set 'sticky' bit to indicate that we should not clean the * database when we transition from initramfs to the real root */ - if (device->db_persist) { - r = fchmod(fileno(f), 01644); - if (r < 0) { - r = -errno; - goto fail; - } - } else { - r = fchmod(fileno(f), 0644); - if (r < 0) { - r = -errno; - goto fail; - } + if (fchmod(fileno(f), device->db_persist ? 01644 : 0644) < 0) { + r = -errno; + goto fail; } if (has_info) { @@ -1077,8 +1068,7 @@ int device_update_db(sd_device *device) { if (r < 0) goto fail; - r = rename(path_tmp, path); - if (r < 0) { + if (rename(path_tmp, path) < 0) { r = -errno; goto fail; }