From 6594c0375b91c3aa1bd991c30ae50197a6d889d4 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 8 Mar 2009 20:20:47 +0000 Subject: 26697: test for Linux- and Mac-style xattr functions --- Src/Modules/attr.c | 30 +++++++++++++++++++++++++----- Src/Modules/attr.mdd | 2 +- 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'Src/Modules') 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 -- cgit 1.4.1