diff mbox

[1/2] Btrfs-progs: let the error message outputed only once

Message ID 1361963001-1934-1-git-send-email-wangshilong1991@gmail.com (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Wang Shilong Feb. 27, 2013, 11:03 a.m. UTC
From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>

If we fail to execute the command:
		btrfs qgroup show <mnt>
It will output the follow messages:
	ERROR: can't perform the search - Inappropriate ioctl for device
	ERROR: can't list qgroups

The error is outputed twice, this is wrong, fix it.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
---
 cmds-qgroup.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

Comments

David Sterba Feb. 27, 2013, 3:11 p.m. UTC | #1
On Wed, Feb 27, 2013 at 07:03:21PM +0800, Wang Shilong wrote:
> From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> 
> If we fail to execute the command:
> 		btrfs qgroup show <mnt>
> It will output the follow messages:
> 	ERROR: can't perform the search - Inappropriate ioctl for device
> 	ERROR: can't list qgroups
> 
> The error is outputed twice, this is wrong, fix it.

Right, thanks. The helper should not print anything. Both patches added to
integration.

david
--
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
diff mbox

Patch

diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 26f0ab0..79888c8 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -120,7 +120,6 @@  int list_qgroups(int fd)
 	struct btrfs_ioctl_search_header *sh;
 	unsigned long off = 0;
 	unsigned int i;
-	int e;
 	struct btrfs_qgroup_info_item *info;
 
 	memset(&args, 0, sizeof(args));
@@ -143,13 +142,9 @@  int list_qgroups(int fd)
 
 	while (1) {
 		ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
-		e = errno;
-		if (ret < 0) {
-			fprintf(stderr,
-				"ERROR: can't perform the search - %s\n",
-				strerror(e));
+		if (ret < 0)
 			return ret;
-		}
+
 		/* the ioctl returns the number of item it found in nr_items */
 		if (sk->nr_items == 0)
 			break;