diff options
Diffstat (limited to 'toys')
-rw-r--r-- | toys/pending/setfattr.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/toys/pending/setfattr.c b/toys/pending/setfattr.c index 7e8bae24..efec9a53 100644 --- a/toys/pending/setfattr.c +++ b/toys/pending/setfattr.c @@ -27,21 +27,15 @@ GLOBALS( char *x, *v, *n; ) -static void do_setfattr(char *file) -{ - int h = toys.optflags & FLAG_h; - - if (toys.optflags&FLAG_x) { - if ((h ? lremovexattr : removexattr)(file, TT.x)) - perror_msg("removexattr failed"); - } else - if ((h ? lsetxattr : setxattr)(file, TT.n, TT.v, TT.v?strlen(TT.v):0, 0)) - perror_msg("setxattr failed"); -} - void setfattr_main(void) { + int h = toys.optflags & FLAG_h, rc; char **s; - for (s=toys.optargs; *s; s++) do_setfattr(*s); + for (s=toys.optargs; *s; s++) { + if (TT.x) rc = (h?lremovexattr:removexattr)(*s, TT.x); + else rc = (h?lsetxattr:setxattr)(*s, TT.n, TT.v, TT.v?strlen(TT.v):0, 0); + + if (rc) perror_msg("%s", *s); + } } |