projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
32a3041
)
fs-util: teach syncfs_path() handle with empty path argument
author
Lennart Poettering
<lennart@poettering.net>
Wed, 3 Feb 2021 20:06:09 +0000
(21:06 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 8 Jul 2021 08:22:34 +0000
(10:22 +0200)
src/basic/fs-util.c
patch
|
blob
|
history
diff --git
a/src/basic/fs-util.c
b/src/basic/fs-util.c
index 7d7beb13dcfc7a1229fbcba34100ce5754f84d62..28c7247e0526f58a46353b9ee7aef34bfc55a14a 100644
(file)
--- a/
src/basic/fs-util.c
+++ b/
src/basic/fs-util.c
@@
-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;