Re: [PATCH v2 4/4] btrfs-progs: Fix the return value when executing 'btrfs pro get' on a uncompress file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 15, 2014 at 10:22 AM, Qu Wenruo <quwenruo@xxxxxxxxxxxxxx> wrote:
> When executing 'btrfs pro get' on a file which is not compressed, return
> value will always be 50 since prop_compress() return -ENOATTR.
>
> But the codes have already check the errno to avoid unnecessary error
> message, so the return value should also set to 0.
>
> Signed-off-by: Qu Wenruo <quwenro@xxxxxxxxxxxxxx>
Reviewed-by: Filipe Manana <fdmanana@xxxxxxxxx>

Thanks Qu

> ---
>  props.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/props.c b/props.c
> index 4d0aeea..c09865b 100644
> --- a/props.c
> +++ b/props.c
> @@ -142,10 +142,12 @@ static int prop_compression(enum prop_object_type type,
>                 sret = fgetxattr(fd, xattr_name, NULL, 0);
>         if (sret < 0) {
>                 ret = -errno;
> -               if (ret != -ENODATA)
> +               if (ret != -ENOATTR)
>                         fprintf(stderr,
>                                 "ERROR: failed to %s compression for %s. %s\n",
>                                 value ? "set" : "get", object, strerror(-ret));
> +               else
> +                       ret = 0;
>                 goto out;
>         }
>         if (!value) {
> --
> 1.9.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux