All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH 3/6] Btrfs-progs: btrfs-restore, fix wrong return value if it fails to read specified fs root
Date: Thu, 19 Jun 2014 09:27:06 +0800	[thread overview]
Message-ID: <1403141229-25565-3-git-send-email-wangsl.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1403141229-25565-1-git-send-email-wangsl.fnst@cn.fujitsu.com>

Steps to reproduce:
 # mkfs.btrfs -f /dev/sda9
 # btrfs restore -f 1 -o /tmp /dev/sda9
 # echo $?

Fix to return 1 in this failure path.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
 cmds-restore.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cmds-restore.c b/cmds-restore.c
index 934755a..48c46ff 100644
--- a/cmds-restore.c
+++ b/cmds-restore.c
@@ -1233,6 +1233,7 @@ int cmd_restore(int argc, char **argv)
 		root->node = read_tree_block(root, fs_location, root->leafsize, 0);
 		if (!root->node) {
 			fprintf(stderr, "Failed to read fs location\n");
+			ret = 1;
 			goto out;
 		}
 	}
-- 
1.9.0


  parent reply	other threads:[~2014-06-19  1:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19  1:27 [PATCH 1/6] Btrfs-progs: fsck: switch to is_fstree() Wang Shilong
2014-06-19  1:27 ` [PATCH 2/6] Btrfs-progs: btrfs-restore,check if specified root is fs/file tree firstly Wang Shilong
2014-06-19  1:27 ` Wang Shilong [this message]
2014-06-19  1:27 ` [PATCH 4/6] Btrfs-progs: btrfs-restore,output resason why it fails to read root Wang Shilong
2014-06-19  1:27 ` [PATCH 5/6] Btrfs-progs: btrfs-restore, don't allow users to specify -r and -f at the same time Wang Shilong
2014-06-19  1:27 ` [PATCH 6/6] Btrfs-progs: btrfs-restore, document updates Wang Shilong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403141229-25565-3-git-send-email-wangsl.fnst@cn.fujitsu.com \
    --to=wangsl.fnst@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.