journal: when creating a new journal file, fsync() the directory it is created in too

Fixes: #2831
This commit is contained in:
Lennart Poettering
2016-04-29 12:23:34 +02:00
parent 6809de5bb1
commit a0fe2a2d20
2 changed files with 43 additions and 1 deletions
+7 -1
View File
@@ -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;
}