• Mikael Magnusson's avatar
    33607: Fix some minor problems in zattr module · a9004ce3
    Mikael Magnusson authored
    Remove the listattr call in zgetattr, it only caused no error to be output
    when trying to retrieve an xattr from a file with no xattrs. When a file
    had xattrs, it would just add an extra syscall for no good reason.
    Always set an array parameter in zlistattr, this makes the returned value
    much easier to use; in fact the _zattr completer didn't account for this
    and zlistattr foo <tab> on a file with only one attribute did not work.
    Almost all of the patch is only reindent, the only modification that's
    not a pure deletions is:
     -        ret = 1 + (attr_len > val_len || attr_len < 0);
     +        ret = 1 + ((val_len > 0 && attr_len > val_len) || attr_len < 0);
    which makes sure we return the correct error in the new path due to the
    removed listattr call. (If val_len is -1 due to no attribute existing,
    it doesn't mean the user should retry the call because the attribute
    grew in size).
attr.c 7.17 KB