]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fs-util: when opening arbitrary inodes, better use O_NONBLOCK
authorLennart Poettering <lennart@poettering.net>
Mon, 1 Feb 2021 16:11:26 +0000 (17:11 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Mar 2021 05:50:38 +0000 (14:50 +0900)
In case this is a device node where opening might block.

src/basic/fs-util.c

index c8885e5aa1a19edabbfef08569e1adb44461bee7..8a726e72de0cd7473ee4f38644a8c93d1b9a1110 100644 (file)
@@ -1472,8 +1472,7 @@ int fsync_path_at(int at_fd, const char *path) {
                 } else
                         fd = at_fd;
         } else {
-
-                opened_fd = openat(at_fd, path, O_RDONLY|O_CLOEXEC);
+                opened_fd = openat(at_fd, path, O_RDONLY|O_CLOEXEC|O_NONBLOCK);
                 if (opened_fd < 0)
                         return -errno;