From 9e5d752591b8d3c3c9a9ab7992d68070ab275400 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 22 Oct 2023 16:25:53 +0200 Subject: [PATCH] smbd: "have_proc_fds" can only work for a real fd Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/modules/vfs_default.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index fe9b8792953..d1a19568e4e 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -744,7 +744,16 @@ static int vfswrap_openat(vfs_handle_struct *handle, } done: - fsp->fsp_flags.have_proc_fds = fsp->conn->have_proc_fds; + if (result >= 0) { + fsp->fsp_flags.have_proc_fds = fsp->conn->have_proc_fds; + } else { + /* + * "/proc/self/fd/-1" never exists. Indicate to upper + * layers that for this fsp a possible name-based + * fallback is the only way to go. + */ + fsp->fsp_flags.have_proc_fds = false; + } out: END_PROFILE(syscall_openat);