161 int ret = setxattr(path, attrname, value, len, 0); |
161 int ret = setxattr(path, attrname, value, len, 0); |
162 free(attrname); |
162 free(attrname); |
163 return ret; |
163 return ret; |
164 } |
164 } |
165 |
165 |
|
166 int xattr_remove(const char *path, const char *name) { |
|
167 char *attrname = name2nsname(name); |
|
168 int ret = removexattr(path, attrname); |
|
169 free(attrname); |
|
170 return ret; |
|
171 } |
|
172 |
166 #endif /* Linux */ |
173 #endif /* Linux */ |
167 |
174 |
168 #ifdef __APPLE__ |
175 #ifdef __APPLE__ |
169 #define XATTR_SUPPORTED |
176 #define XATTR_SUPPORTED |
170 #include <sys/xattr.h> |
177 #include <sys/xattr.h> |
246 int xattr_set(const char *path, const char *name, const void *value, size_t len) { |
253 int xattr_set(const char *path, const char *name, const void *value, size_t len) { |
247 int ret = setxattr(path, name, value, len, 0, 0); |
254 int ret = setxattr(path, name, value, len, 0, 0); |
248 return ret; |
255 return ret; |
249 } |
256 } |
250 |
257 |
|
258 int xattr_remove(const char *path, const char *name) { |
|
259 return removexattr(path, name, 0); |
|
260 } |
|
261 |
251 #endif /* Apple */ |
262 #endif /* Apple */ |
252 |
263 |
253 #ifdef __sun |
264 #ifdef __sun |
254 #define XATTR_SUPPORTED |
265 #define XATTR_SUPPORTED |
255 #include <unistd.h> |
266 #include <unistd.h> |
439 int xattr_set(const char *path, const char *name, const void *value, size_t len) { |
461 int xattr_set(const char *path, const char *name, const void *value, size_t len) { |
440 int ret = extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, value, len); |
462 int ret = extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, value, len); |
441 return ret; |
463 return ret; |
442 } |
464 } |
443 |
465 |
|
466 int xattr_remove(const char *path, const char *name) { |
|
467 return extattr_delete_file(path, EXTATTR_NAMESPACE_USER, name); |
|
468 } |
|
469 |
444 #endif /* FreeBSD */ |
470 #endif /* FreeBSD */ |
445 |
471 |
446 |
472 |
447 #ifndef XATTR_SUPPORTED |
473 #ifndef XATTR_SUPPORTED |
448 |
474 |