aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/9p-util.h
diff options
context:
space:
mode:
Diffstat (limited to 'hw/9pfs/9p-util.h')
-rw-r--r--hw/9pfs/9p-util.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h
index 091f3ce88e..517027c520 100644
--- a/hw/9pfs/9p-util.h
+++ b/hw/9pfs/9p-util.h
@@ -22,7 +22,13 @@ static inline void close_preserve_errno(int fd)
static inline int openat_dir(int dirfd, const char *name)
{
- return openat(dirfd, name, O_DIRECTORY | O_RDONLY | O_PATH);
+#ifdef O_PATH
+#define OPENAT_DIR_O_PATH O_PATH
+#else
+#define OPENAT_DIR_O_PATH 0
+#endif
+ return openat(dirfd, name,
+ O_DIRECTORY | O_RDONLY | O_NOFOLLOW | OPENAT_DIR_O_PATH);
}
static inline int openat_file(int dirfd, const char *name, int flags,