logo

utils-std

Collection of commonly available Unix tools
commit: c451b2915c7205eb870a19833f02719b6555183f
parent c7b022a8301f736da32b4605ee7f4869ea9587f9
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:

Mcmd/mv.c9++++++++-
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;