commit: b471ce1a39b3b2657c952de9eb5ddff964a07a7f
parent 25a9d9a5fde550014780e63feacde846a213942c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 11 May 2024 18:42:11 +0200
cmd/mv: workaround lack of O_SEARCH in glibc
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/cmd/mv.c b/cmd/mv.c
@@ -11,7 +11,7 @@
#include <assert.h>
#include <errno.h>
-#include <fcntl.h> // open
+#include <fcntl.h> // open
#include <locale.h> // setlocale
#include <stdbool.h>
#include <stdint.h> // SIZE_MAX
@@ -20,6 +20,13 @@
#include <sys/stat.h> // stat, S_ISDIR
#include <unistd.h> // getopt
+// Workaround against GNU glibc
+// https://sourceware.org/bugzilla/show_bug.cgi?id=18228
+#if defined(__linux__) && !defined(O_SEARCH)
+// As defined in musl
+#define O_SEARCH O_PATH
+#endif
+
char *argv0 = "mv";
bool no_clob = false, force = false;