summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/compat.h7
-rw-r--r--lib/compat/Makemodule.am3
-rw-r--r--lib/compat/mockups.c49
3 files changed, 58 insertions, 1 deletions
diff --git a/include/compat.h b/include/compat.h
index fae9d92..53c2e93 100644
--- a/include/compat.h
+++ b/include/compat.h
@@ -98,6 +98,13 @@ struct stat {
(((x)&0x00000fffULL) << 8) | \
(((y)&0xffffff00ULL) << 12) | \
(((y)&0x000000ffULL)) )
+
+#define AT_FDCWD (0xDEADBEEF)
+#define AT_SYMLINK_NOFOLLOW (0x01)
+
+int fchownat(int dirfd, const char *path, int uid, int gid, int flags);
+
+int fchmodat(int dirfd, const char *path, int mode, int flags);
#else
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/compat/Makemodule.am b/lib/compat/Makemodule.am
index c197fb0..7ba3444 100644
--- a/lib/compat/Makemodule.am
+++ b/lib/compat/Makemodule.am
@@ -1,4 +1,5 @@
libcompat_a_SOURCES = lib/compat/getline.c lib/compat/getsubopt.c
-libcompat_a_SOURCES += lib/compat/strndup.c include/compat.h
+libcompat_a_SOURCES += lib/compat/strndup.c lib/compat/mockups.c
+libcompat_a_SOURCES += include/compat.h
noinst_LIBRARIES += libcompat.a
diff --git a/lib/compat/mockups.c b/lib/compat/mockups.c
new file mode 100644
index 0000000..22f0820
--- /dev/null
+++ b/lib/compat/mockups.c
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * mockups.c
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#include "config.h"
+#include "compat.h"
+
+#ifdef _WIN32
+int fchownat(int dirfd, const char *path, int uid, int gid, int flags)
+{
+ if (dirfd != AT_FDCWD) {
+ fputs("[FIXME] fchownat stub only supports AT_FDCWD!\n",
+ stderr);
+ return -1;
+ }
+
+ if (flags != 0 && flags != AT_SYMLINK_NOFOLLOW) {
+ fputs("[FIXME] fchownat stub used with an unknown flag!\n",
+ stderr);
+ return -1;
+ }
+
+ (void)path;
+ (void)uid;
+ (void)gid;
+ return 0;
+}
+
+int fchmodat(int dirfd, const char *path, int mode, int flags)
+{
+ if (dirfd != AT_FDCWD) {
+ fputs("[FIXME] fchmodat stub only supports AT_FDCWD!\n",
+ stderr);
+ return -1;
+ }
+
+ if (flags != 0 && flags != AT_SYMLINK_NOFOLLOW) {
+ fputs("[FIXME] fchmodat stub used with an unknown flag!\n",
+ stderr);
+ return -1;
+ }
+
+ (void)path;
+ (void)mode;
+ return 0;
+}
+#endif