diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-02-19 18:23:38 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-02-20 15:39:31 +0100 |
commit | 11b29a96e98054ed69a2314ed71a286e852fa24e (patch) | |
tree | 625dc2f77e386ca4d1178e79fd2c0e8723cf4b08 /src/test/test-fs-util.c | |
parent | 3cc44114038621237a9d8ee4be3ff836138a55c1 (diff) | |
download | systemd-11b29a96e98054ed69a2314ed71a286e852fa24e.tar.gz |
fs-util: move fsync_directory_of_file() into generic code
This function used by the journal code is pretty useful generically,
let's move it to fs-util.c to make it useful for other code too.
Diffstat (limited to 'src/test/test-fs-util.c')
-rw-r--r-- | src/test/test-fs-util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c index 184a2a52c2..ebcec4fcc5 100644 --- a/src/test/test-fs-util.c +++ b/src/test/test-fs-util.c @@ -552,6 +552,15 @@ static void test_unlinkat_deallocate(void) { assert_se(st.st_nlink == 0); } +static void test_fsync_directory_of_file(void) { + _cleanup_close_ int fd = -1; + + fd = open_tmpfile_unlinkable(NULL, O_RDWR); + assert_se(fd >= 0); + + assert_se(fsync_directory_of_file(fd) >= 0); +} + int main(int argc, char *argv[]) { test_unlink_noerrno(); test_get_files_in_directory(); @@ -562,6 +571,7 @@ int main(int argc, char *argv[]) { test_access_fd(); test_touch_file(); test_unlinkat_deallocate(); + test_fsync_directory_of_file(); return 0; } |