mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 07:51:21 +03:00
fs-util: teach syncfs_path() handle with empty path argument
This commit is contained in:
parent
32a3041656
commit
4050625e5b
@ -1527,9 +1527,13 @@ int fsync_path_and_parent_at(int at_fd, const char *path) {
|
||||
int syncfs_path(int atfd, const char *path) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
|
||||
assert(path);
|
||||
if (isempty(path)) {
|
||||
if (atfd != AT_FDCWD)
|
||||
return syncfs(atfd) < 0 ? -errno : 0;
|
||||
|
||||
fd = openat(atfd, path, O_CLOEXEC|O_RDONLY|O_NONBLOCK);
|
||||
fd = open(".", O_RDONLY|O_DIRECTORY|O_CLOEXEC);
|
||||
} else
|
||||
fd = openat(atfd, path, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user