From: Chen Yang <chenyang.fnst@cn.fujitsu.com>
To: linux-btrfs <linux-btrfs@vger.kernel.org>, miaox@cn.fujitsu.com
Subject: [PATCH] Btrfs-prog/send: fix wrong dump_fd check in cmd_send_start()
Date: Thu, 31 Jan 2013 16:21:24 +0800 [thread overview]
Message-ID: <510A2984.6010601@cn.fujitsu.com> (raw)
In-Reply-To: <510A2791.1010607@cn.fujitsu.com>
In cmd_send_start(), there is a check to make sure dump_fd is not a tty
before parsing command options. So if we use the option "-f file",
it doesn't work for the dump_fd has not been created. So fix it.
Signed-off-by: Cheng Yang <chenyang.fnst@cn.fujitsu.com>
---
cmds-send.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/cmds-send.c b/cmds-send.c
index 2b9a610..aafa800 100644
--- a/cmds-send.c
+++ b/cmds-send.c
@@ -429,11 +429,6 @@ int cmd_send_start(int argc, char **argv)
memset(&send, 0, sizeof(send));
send.dump_fd = fileno(stdout);
- if (isatty(send.dump_fd)) {
- fprintf(stderr, "ERROR: not dumping send stream into a terminal, redirect it into a file\n");
- return 1;
- }
-
while ((c = getopt(argc, argv, "vf:i:p:")) != -1) {
switch (c) {
case 'v':
@@ -497,6 +492,13 @@ int cmd_send_start(int argc, char **argv)
}
}
+ if (isatty(send.dump_fd)) {
+ fprintf(stderr,
+ "ERROR: not dumping send stream into a terminal, "
+ "redirect it into a file\n");
+ return 1;
+ }
+
/* use first send subvol to determine mount_root */
subvol = argv[optind];
--
1.7.7.6
next parent reply other threads:[~2013-01-31 8:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <510A2791.1010607@cn.fujitsu.com>
2013-01-31 8:21 ` Chen Yang [this message]
2013-01-31 16:52 ` [PATCH] Btrfs-prog/send: fix wrong dump_fd check in cmd_send_start() David Sterba
2013-02-01 2:58 ` Chen Yang
2013-02-01 12:31 ` David Sterba
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=510A2984.6010601@cn.fujitsu.com \
--to=chenyang.fnst@cn.fujitsu.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=miaox@cn.fujitsu.com \
/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 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).