linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 4/4] btrfs-progs: Fix the return value when executing 'btrfs pro get' on a uncompress file.
@ 2014-04-15  9:22 Qu Wenruo
  2014-04-15  9:27 ` Filipe David Manana
  2014-04-22 12:37 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Qu Wenruo @ 2014-04-15  9:22 UTC (permalink / raw)
  To: linux-btrfs

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@cn.fujitsu.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 4/4] btrfs-progs: Fix the return value when executing 'btrfs pro get' on a uncompress file.
  2014-04-15  9:22 [PATCH v2 4/4] btrfs-progs: Fix the return value when executing 'btrfs pro get' on a uncompress file Qu Wenruo
@ 2014-04-15  9:27 ` Filipe David Manana
  2014-04-22 12:37 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: Filipe David Manana @ 2014-04-15  9:27 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs@vger.kernel.org

On Tue, Apr 15, 2014 at 10:22 AM, Qu Wenruo <quwenruo@cn.fujitsu.com> 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@cn.fujitsu.com>
Reviewed-by: Filipe Manana <fdmanana@gmail.com>

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@vger.kernel.org
> 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."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 4/4] btrfs-progs: Fix the return value when executing 'btrfs pro get' on a uncompress file.
  2014-04-15  9:22 [PATCH v2 4/4] btrfs-progs: Fix the return value when executing 'btrfs pro get' on a uncompress file Qu Wenruo
  2014-04-15  9:27 ` Filipe David Manana
@ 2014-04-22 12:37 ` David Sterba
  2014-04-23  1:22   ` Qu Wenruo
  1 sibling, 1 reply; 4+ messages in thread
From: David Sterba @ 2014-04-22 12:37 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Tue, Apr 15, 2014 at 05:22:24PM +0800, Qu Wenruo 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@cn.fujitsu.com>

JFYI, I've edited the subject and changelog, let's use the 'prop'
abbreviation for properties.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 4/4] btrfs-progs: Fix the return value when executing 'btrfs pro get' on a uncompress file.
  2014-04-22 12:37 ` David Sterba
@ 2014-04-23  1:22   ` Qu Wenruo
  0 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2014-04-23  1:22 UTC (permalink / raw)
  To: dsterba, linux-btrfs


-------- Original Message --------
Subject: Re: [PATCH v2 4/4] btrfs-progs: Fix the return value when 
executing 'btrfs pro get' on a uncompress file.
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Date: 2014年04月22日 20:37
> On Tue, Apr 15, 2014 at 05:22:24PM +0800, Qu Wenruo 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@cn.fujitsu.com>
> JFYI, I've edited the subject and changelog, let's use the 'prop'
> abbreviation for properties.
Thanks for that.
My poor English seems always to be a problem.  :(

Qu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-23  1:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-15  9:22 [PATCH v2 4/4] btrfs-progs: Fix the return value when executing 'btrfs pro get' on a uncompress file Qu Wenruo
2014-04-15  9:27 ` Filipe David Manana
2014-04-22 12:37 ` David Sterba
2014-04-23  1:22   ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).