mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 07:51:21 +03:00
homework: replace homegrown syncfs_path() reimplementation by syncfs_path()
This commit is contained in:
parent
a23cf7f4c7
commit
a70e0ad764
@ -3161,15 +3161,9 @@ int home_lock_luks(UserRecord *h, HomeSetup *setup) {
|
|||||||
log_info("Discovered used LUKS device %s.", setup->dm_node);
|
log_info("Discovered used LUKS device %s.", setup->dm_node);
|
||||||
|
|
||||||
assert_se(p = user_record_home_directory(h));
|
assert_se(p = user_record_home_directory(h));
|
||||||
|
r = syncfs_path(AT_FDCWD, p);
|
||||||
setup->root_fd = open(p, O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOFOLLOW);
|
if (r < 0) /* Snake oil, but let's better be safe than sorry */
|
||||||
if (setup->root_fd < 0)
|
return log_error_errno(r, "Failed to synchronize file system %s: %m", p);
|
||||||
return log_error_errno(errno, "Failed to open home directory: %m");
|
|
||||||
|
|
||||||
if (syncfs(setup->root_fd) < 0) /* Snake oil, but let's better be safe than sorry */
|
|
||||||
return log_error_errno(errno, "Failed to synchronize file system %s: %m", p);
|
|
||||||
|
|
||||||
setup->root_fd = safe_close(setup->root_fd);
|
|
||||||
|
|
||||||
log_info("File system synchronized.");
|
log_info("File system synchronized.");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user