int sys_lremovexattr (const char *path, const char *uname) { const char *name = prefix(uname); #if defined(HAVE_LREMOVEXATTR) return lremovexattr(path, name); #elif defined(HAVE_REMOVEXATTR) && defined(XATTR_ADD_OPT) int options = XATTR_NOFOLLOW; return removexattr(path, name, options); #elif defined(HAVE_LREMOVEEA) return lremoveea(path, name); #elif defined(HAVE_EXTATTR_DELETE_LINK) return extattr_delete_link(path, EXTATTR_NAMESPACE_USER, uname); #elif defined(HAVE_ATTR_REMOVE) int flags = ATTR_DONTFOLLOW; char *attrname = strchr(name,'.') + 1; if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT; return attr_remove(path, attrname, flags); #elif defined(HAVE_ATTROPEN) int ret = -1; int attrdirfd = solaris_attropen(path, ".", O_RDONLY|AT_SYMLINK_NOFOLLOW, 0); if (attrdirfd >= 0) { ret = solaris_unlinkat(attrdirfd, name); close(attrdirfd); } return ret; #else errno = ENOSYS; return -1; #endif }
int sys_fremovexattr (int filedes, const char *path, const char *uname) { const char *name = prefix(uname); #if defined(HAVE_REMOVEXATTR) #ifndef XATTR_ADD_OPT return removexattr(path, name); #else int options = 0; return removexattr(path, name, options); #endif #elif defined(HAVE_REMOVEEA) return removeea(path, name); #elif defined(HAVE_EXTATTR_DELETE_FILE) return extattr_delete_file(path, EXTATTR_NAMESPACE_USER, uname); #elif defined(HAVE_ATTR_REMOVE) int flags = 0; char *attrname = strchr(name,'.') + 1; if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT; return attr_remove(path, attrname, flags); #elif defined(SOLARIS) int ret = -1; int attrdirfd = solaris_attropenat(filedes, path, ".", O_RDONLY, 0); if (attrdirfd >= 0) { ret = solaris_unlinkat(attrdirfd, name); close(attrdirfd); } return ret; #else errno = ENOSYS; return -1; #endif }
int rep_fremovexattr (int filedes, const char *name) { #if defined(HAVE_FREMOVEXATTR) #ifndef XATTR_ADDITIONAL_OPTIONS return fremovexattr(filedes, name); #else /* So that we do not recursivly call this function */ #undef fremovexattr int options = 0; return fremovexattr(filedes, name, options); #endif #elif defined(HAVE_FREMOVEEA) return fremoveea(filedes, name); #elif defined(HAVE_EXTATTR_DELETE_FD) char *s; int attrnamespace = (strncmp(name, "system", 6) == 0) ? EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER; const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1; return extattr_delete_fd(filedes, attrnamespace, attrname); #elif defined(HAVE_ATTR_REMOVEF) int flags = 0; char *attrname = strchr(name,'.') + 1; if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT; return attr_removef(filedes, attrname, flags); #elif defined(HAVE_ATTROPEN) int ret = -1; int attrdirfd = solaris_openat(filedes, ".", O_RDONLY|O_XATTR, 0); if (attrdirfd >= 0) { ret = solaris_unlinkat(attrdirfd, name); close(attrdirfd); } return ret; #else errno = ENOSYS; return -1; #endif }