From b9704715fb020d0e6188a420aae42ba3b8a55b17 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Oct 2023 15:26:41 +0200 Subject: [PATCH] io/FileOutputStream: pass dfd=-1 for absolute /proc/self/fd/N path --- src/io/FileOutputStream.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io/FileOutputStream.cxx b/src/io/FileOutputStream.cxx index 41bfed299..c9e56c144 100644 --- a/src/io/FileOutputStream.cxx +++ b/src/io/FileOutputStream.cxx @@ -281,7 +281,7 @@ try { unlinkat(directory_fd.Get(), GetPath().c_str(), 0); /* hard-link the temporary file to the final path */ - if (linkat(AT_FDCWD, + if (linkat(-1, FmtBuffer<64>("/proc/self/fd/{}", fd.Get()), directory_fd.Get(), path.c_str(), AT_SYMLINK_FOLLOW) < 0)