diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-22 11:28:31 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-22 11:28:31 +0100 |
commit | dd4d7e713290d9cecbebc6933e41d027bac63c8f (patch) | |
tree | e252c2ddce438e1dc80d05d30b1bedd620342a92 /lib/compat/mockups.c | |
parent | eafaffa0f09b7c22eed906ef5356b1460d44da55 (diff) |
Add fchownat/fchmodat mockups to libcompat for Windows
Not pretty, but definitely prettier than #ifdef hell.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/compat/mockups.c')
-rw-r--r-- | lib/compat/mockups.c | 49 |
1 files changed, 49 insertions, 0 deletions
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 |