mirror of
https://github.com/systemd/systemd.git
synced 2025-08-15 01:49:58 +03:00
sd-device: shorten code a bit
This commit is contained in:
committed by
Lennart Poettering
parent
29e6f70b8d
commit
827f865063
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user