]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tools/nolibc: split implicit open flags into a macro
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 14 May 2026 12:05:11 +0000 (14:05 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Thu, 14 May 2026 15:41:02 +0000 (17:41 +0200)
This logic is duplicated and its current form will be in the way of some
upcoming simplificiations.

Move it into a macro to avoid the duplication and enable some cleanups.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260514-nolibc-open-tmpfile-v2-1-b4c6c5efa266@weissschuh.net
tools/include/nolibc/fcntl.h

index 014910a8e928de44e944d95b65b5e2174a23d550..46f591cf82fd7ec67a727e170d6cc54b3a838e7d 100644 (file)
@@ -14,6 +14,8 @@
 #include "types.h"
 #include "sys.h"
 
+#define __nolibc_open_flags(_flags) ((_flags) | O_LARGEFILE)
+
 /*
  * int openat(int dirfd, const char *path, int flags[, mode_t mode]);
  */
@@ -29,8 +31,6 @@ int openat(int dirfd, const char *path, int flags, ...)
 {
        mode_t mode = 0;
 
-       flags |= O_LARGEFILE;
-
        if (flags & O_CREAT) {
                va_list args;
 
@@ -39,7 +39,7 @@ int openat(int dirfd, const char *path, int flags, ...)
                va_end(args);
        }
 
-       return __sysret(_sys_openat(dirfd, path, flags, mode));
+       return __sysret(_sys_openat(dirfd, path, __nolibc_open_flags(flags), mode));
 }
 
 /*
@@ -57,8 +57,6 @@ int open(const char *path, int flags, ...)
 {
        mode_t mode = 0;
 
-       flags |= O_LARGEFILE;
-
        if (flags & O_CREAT) {
                va_list args;
 
@@ -67,7 +65,7 @@ int open(const char *path, int flags, ...)
                va_end(args);
        }
 
-       return __sysret(_sys_open(path, flags, mode));
+       return __sysret(_sys_open(path, __nolibc_open_flags(flags), mode));
 }
 
 /*