diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-04-26 15:47:55 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-04-29 12:23:34 +0200 |
commit | a0fe2a2d2028ea8b5e6873b1f55e91a36081656c (patch) | |
tree | 1337f3a3a093fb94a46346988213018a70c4a9a0 /src/basic/fd-util.c | |
parent | 6809de5bb109b717c0ad6723956ffff2018cb65e (diff) |
journal: when creating a new journal file, fsync() the directory it is created in too
Fixes: #2831
Diffstat (limited to 'src/basic/fd-util.c')
-rw-r--r-- | src/basic/fd-util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index 9130d023d7..8b466cff15 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -361,8 +361,14 @@ bool fdname_is_valid(const char *s) { int fd_get_path(int fd, char **ret) { char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int)]; + int r; xsprintf(procfs_path, "/proc/self/fd/%i", fd); - return readlink_malloc(procfs_path, ret); + r = readlink_malloc(procfs_path, ret); + + if (r == -ENOENT) /* If the file doesn't exist the fd is invalid */ + return -EBADF; + + return r; } |