OpenBSD has no xattrs, help recoll build anyway
This commit is contained in:
parent
0dc7a977ea
commit
e825286037
@ -27,16 +27,24 @@ OTHER DEALINGS IN THE SOFTWARE.
|
||||
\brief Portable External Attributes API
|
||||
*/
|
||||
|
||||
// PXALINUX: platforms like kfreebsd which aren't linux but use the
|
||||
// same xattr interface
|
||||
#if defined(__gnu_linux__) || \
|
||||
(defined(__FreeBSD_kernel__)&&defined(__GLIBC__)&&!defined(__FreeBSD__)) ||\
|
||||
defined(__CYGWIN__)
|
||||
#define PXALINUX
|
||||
#endif
|
||||
|
||||
// If the platform is not supported, let this file be empty instead of
|
||||
// If the platform is not known yet, let this file be empty instead of
|
||||
// breaking the compile, this will let the build work if the rest of
|
||||
// the software is not actually calling us.
|
||||
#if defined(__FreeBSD__) || defined(PXALINUX) || defined(__APPLE__)
|
||||
// the software is not actually calling us. If it does call us, this
|
||||
// will bring attention to the necessity of a port.
|
||||
//
|
||||
// If the platform is known not supporting extattrs (e.g.__OpenBSD__),
|
||||
// just let the methods return errors (like they would on a non-xattr
|
||||
// fs on e.g. linux)
|
||||
#if defined(__FreeBSD__) || defined(PXALINUX) || defined(__APPLE__) \
|
||||
|| defined(__OpenBSD__)
|
||||
|
||||
|
||||
#ifndef TEST_PXATTR
|
||||
@ -52,6 +60,7 @@ OTHER DEALINGS IN THE SOFTWARE.
|
||||
#include <sys/xattr.h>
|
||||
#elif defined(__APPLE__)
|
||||
#include <sys/xattr.h>
|
||||
#elif defined(__OpenBSD__)
|
||||
#else
|
||||
#error "Unknown system can't compile"
|
||||
#endif
|
||||
@ -162,6 +171,8 @@ get(int fd, const string& path, const string& _name, string *value,
|
||||
} else {
|
||||
ret = fgetxattr(fd, name.c_str(), buf.buf, ret, 0, 0);
|
||||
}
|
||||
#else
|
||||
errno = ENOTSUP;
|
||||
#endif
|
||||
|
||||
if (ret >= 0)
|
||||
@ -257,6 +268,8 @@ set(int fd, const string& path, const string& _name,
|
||||
ret = fsetxattr(fd, name.c_str(), value.c_str(),
|
||||
value.length(), 0, opts);
|
||||
}
|
||||
#else
|
||||
errno = ENOTSUP;
|
||||
#endif
|
||||
return ret >= 0;
|
||||
}
|
||||
@ -302,6 +315,8 @@ del(int fd, const string& path, const string& _name, flags flags, nspace dom)
|
||||
} else {
|
||||
ret = fremovexattr(fd, name.c_str(), 0);
|
||||
}
|
||||
#else
|
||||
errno = ENOTSUP;
|
||||
#endif
|
||||
return ret >= 0;
|
||||
}
|
||||
@ -384,8 +399,13 @@ list(int fd, const string& path, vector<string>* names, flags flags, nspace dom)
|
||||
} else {
|
||||
ret = flistxattr(fd, buf.buf, ret, 0);
|
||||
}
|
||||
#else
|
||||
errno = ENOTSUP;
|
||||
#endif
|
||||
|
||||
if (ret < 0)
|
||||
return false;
|
||||
|
||||
char *bufstart = buf.buf;
|
||||
|
||||
// All systems return a 0-separated string list except FreeBSD
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user