From patchwork Wed Feb 27 11:03:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 2192871 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 7C1A5DF2F2 for ; Wed, 27 Feb 2013 11:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756614Ab3B0LD2 (ORCPT ); Wed, 27 Feb 2013 06:03:28 -0500 Received: from mail-da0-f42.google.com ([209.85.210.42]:37969 "EHLO mail-da0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754558Ab3B0LD1 (ORCPT ); Wed, 27 Feb 2013 06:03:27 -0500 Received: by mail-da0-f42.google.com with SMTP id n15so247300dad.29 for ; Wed, 27 Feb 2013 03:03:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=VA5uzj8Ce6PYQEYQINYHIuc6tbPU08u/HNnOIXyOyU8=; b=oCRY9ASp49FDs39Jt1QLj5pu6OOwP+LK00ZbrypgbO21MuK8S4HVXNOrzvXqg+rA9P zVWCoQD1y0UJ2Y0p4nVhnh9BeV7ygkhyIfUJ9pIQBctc5ptRcXgP0KVam5tuBaOIZxzy Dh18PXc/fLmBfg+muNd2ATOZNd3ehqIUS2iFiL489ThCoZ9GCfMLbpsKtB3/AnRXXjC0 w5cvdRY08kWqBYiBumhWvlVJo0rgI5UsIf+yGVjqFSDyhIXRGlx926HmSNWjthMbnAHz Jtk16C6Jdp08ctrnT6fYu7UyIVoVvPhbD0upt877JN4GlOedUuG/4rVUwGRi+DfqCQIJ nmPQ== X-Received: by 10.66.151.226 with SMTP id ut2mr6930807pab.53.1361963007178; Wed, 27 Feb 2013 03:03:27 -0800 (PST) Received: from localhost.localdomain ([112.23.170.203]) by mx.google.com with ESMTPS id t4sm5027969pax.0.2013.02.27.03.03.25 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 03:03:26 -0800 (PST) From: Wang Shilong To: linux-btrfs@vger.kernel.org Cc: wangshilong1991@gmail.com Subject: [PATCH 1/2] Btrfs-progs: let the error message outputed only once Date: Wed, 27 Feb 2013 19:03:21 +0800 Message-Id: <1361963001-1934-1-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 1.7.11.7 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Wang Shilong If we fail to execute the command: btrfs qgroup show 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 --- cmds-qgroup.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) 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;