[PATCH] Btrfs-prog/send: fix wrong dump_fd check in cmd_send_start()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux