From 1071c195f7b7fc4d8af31f9acb7fd281bf034af5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 1 Feb 2021 17:11:26 +0100 Subject: [PATCH] fs-util: when opening arbitrary inodes, better use O_NONBLOCK In case this is a device node where opening might block. --- src/basic/fs-util.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index c8885e5aa1a..8a726e72de0 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -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; -- 2.47.3