diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2009-03-08 20:20:47 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2009-03-08 20:20:47 +0000 |
commit | 6594c0375b91c3aa1bd991c30ae50197a6d889d4 (patch) | |
tree | 02d80eee3e6b6b962aba6fab9377584234a6f490 /Src/Modules | |
parent | d968acfacd3db570a4275f8abfc5804024230bd3 (diff) | |
download | zsh-6594c0375b91c3aa1bd991c30ae50197a6d889d4.tar.gz zsh-6594c0375b91c3aa1bd991c30ae50197a6d889d4.tar.xz zsh-6594c0375b91c3aa1bd991c30ae50197a6d889d4.zip |
26697: test for Linux- and Mac-style xattr functions
Diffstat (limited to 'Src/Modules')
-rw-r--r-- | Src/Modules/attr.c | 30 | ||||
-rw-r--r-- | Src/Modules/attr.mdd | 2 |
2 files changed, 26 insertions, 6 deletions
diff --git a/Src/Modules/attr.c b/Src/Modules/attr.c index b6f9d7084..ec3b1e421 100644 --- a/Src/Modules/attr.c +++ b/Src/Modules/attr.c @@ -42,8 +42,16 @@ bin_getattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) unmetafy(*argv, &slen); unmetafy(*(argv+1), NULL); - if (listxattr(*argv, NULL, 0) > 0) { - if (0 < (len = getxattr(*argv, *(argv+1), value, 255))) { + if (listxattr(*argv, NULL, 0 +#ifdef XATTR_EXTRA_ARGS + , 0 +#endif + ) > 0) { + if (0 < (len = getxattr(*argv, *(argv+1), value, 255 +#ifdef XATTR_EXTRA_ARGS + , 0, 0 +#endif + ))) { if (len < 256) { value[len] = '\0'; if (*(argv+2)) @@ -67,7 +75,11 @@ bin_setattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) unmetafy(*argv, &slen); unmetafy(*(argv+1), NULL); unmetafy(*(argv+2), NULL); - if (setxattr(*argv, *(argv+1), *(argv+2), strlen(*(argv+2)), 0)) { + if (setxattr(*argv, *(argv+1), *(argv+2), strlen(*(argv+2)), 0 +#ifdef XATTR_EXTRA_ARGS + , 0 +#endif + )) { zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno); ret = 1; } @@ -81,7 +93,11 @@ bin_delattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) unmetafy(*argv, &slen); unmetafy(*(argv+1), NULL); - if (removexattr(*argv, *(argv+1))) { + if (removexattr(*argv, *(argv+1) +#ifdef XATTR_EXTRA_ARGS + , 0 +#endif + )) { zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno); ret = 1; } @@ -96,7 +112,11 @@ bin_listattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) char value[256]; unmetafy(*argv, &slen); - if (0 < (len = listxattr(*argv, value, 256))) { + if (0 < (len = listxattr(*argv, value, 256 +#ifdef XATTR_EXTRA_ARGS + , 0 +#endif + ))) { if (len < 256) { char *p = value; if (*(argv+1)) diff --git a/Src/Modules/attr.mdd b/Src/Modules/attr.mdd index 52f3e2420..fbe917bbf 100644 --- a/Src/Modules/attr.mdd +++ b/Src/Modules/attr.mdd @@ -1,5 +1,5 @@ name=zsh/attr -link='if test "x$ac_cv_func_getxattr" = xyes && test "x$ac_cv_header_sys_xattr_h" = xyes; then +link='if test "x$zsh_cv_use_xattr" = xyes; then echo dynamic else echo no |