stat: protect acl and xattr from Windows

This commit is contained in:
Danny Robson 2020-12-06 07:03:04 +10:00
parent c1f19faba4
commit 7f2b4ba8d9

View File

@ -1,25 +1,28 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/acl.h>
#include "../acl.hpp"
#include <cruft/util/bitwise.hpp> #include <cruft/util/bitwise.hpp>
#include <cruft/util/posix/except.hpp> #include <cruft/util/posix/except.hpp>
#include <cruft/util/posix/util.hpp> #include <cruft/util/posix/util.hpp>
#include <cruft/util/posix/ostream.hpp> #include <cruft/util/posix/ostream.hpp>
#include <cruft/util/string.hpp> #include <cruft/util/string.hpp>
#include <cruft/util/platform.hpp>
#include <iostream> #include <iostream>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/xattr.h>
#include <unistd.h> #include <unistd.h>
#include <cstdlib> #include <cstdlib>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if !defined(PLATFORM_WIN32)
#include <sys/xattr.h>
#include "acl.hpp"
void do_xattr (char const *path) void do_xattr (char const *path)
{ {
std::cout << ", xattr: "; std::cout << ", xattr: ";
@ -75,6 +78,11 @@ void do_acl (char const *path)
std::cout << cruft::acl (path, ACL_TYPE_ACCESS) << '\n'; std::cout << cruft::acl (path, ACL_TYPE_ACCESS) << '\n';
} }
#else
void do_xattr (char const *) { }
void do_acl (char const *) { }
#endif
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int main (int argc, char **argv) int main (int argc, char **argv)