From ebb79ad32a3961ce7efc1eb0de3ddd58698df829 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 8 Jul 2021 14:49:26 +0200 Subject: [PATCH] file_utils: surface ENOENT when falling back to openat() Link: https://discuss.linuxcontainers.org/t/error-failed-to-retrieve-pid-of-executing-child-process Signed-off-by: Christian Brauner --- src/lxc/file_utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lxc/file_utils.c b/src/lxc/file_utils.c index e7e87de9b..13a870552 100644 --- a/src/lxc/file_utils.c +++ b/src/lxc/file_utils.c @@ -663,7 +663,11 @@ int open_at(int dfd, const char *path, unsigned int o_flags, if (errno != ENOSYS) return -errno; - return openat(dfd, path, o_flags, mode); + fd = openat(dfd, path, o_flags, mode); + if (fd < 0) + return -errno; + + return move_fd(fd); } int fd_make_nonblocking(int fd) -- 2.47.2