gentoo-overlay/sys-apps/systemd/files/0004-fs-util-Handle-musl-O_...

33 lines
1.2 KiB
Diff

From df3fdeb9091977698a3c6775ed835b68105b6ae6 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Sun, 18 Aug 2024 02:09:55 -0500
Subject: [PATCH 04/34] fs-util: Handle musl O_ACCMODE containing O_PATH
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
O_ACCMODE strictly includes 'O_SEARCH', but that is defined as 'O_PATH'
in musl. This makes the read-only test fail when O_PATH is specified as
a flag for open_mkdir_at.
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
---
src/basic/fs-util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
index 64d309317d52..744ce847ffe5 100644
--- a/src/basic/fs-util.c
+++ b/src/basic/fs-util.c
@@ -1036,7 +1036,7 @@ int open_mkdir_at_full(int dirfd, const char *path, int flags, XOpenFlags xopen_
if (flags & ~(O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_EXCL|O_NOATIME|O_NOFOLLOW|O_PATH))
return -EINVAL;
- if ((flags & O_ACCMODE) != O_RDONLY)
+ if (((flags & O_ACCMODE) & ~O_PATH) != O_RDONLY)
return -EINVAL;
/* Note that O_DIRECTORY|O_NOFOLLOW is implied, but we allow specifying it anyway. The following
--
2.41.0