diff mbox

[06/17] btrfs-progs: fix open error test in cmd_start_replace

Message ID 1361832890-40921-7-git-send-email-sandeen@redhat.com (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Eric Sandeen Feb. 25, 2013, 10:54 p.m. UTC
open() returns a negative fd on failure, not 0.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
 cmds-replace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/cmds-replace.c b/cmds-replace.c
index d14c9b5..9397396 100644
--- a/cmds-replace.c
+++ b/cmds-replace.c
@@ -235,7 +235,7 @@  static int cmd_start_replace(int argc, char **argv)
 		}
 	} else {
 		fdsrcdev = open(srcdev, O_RDWR);
-		if (!fdsrcdev) {
+		if (fdsrcdev < 0) {
 			fprintf(stderr, "Error: Unable to open device '%s'\n",
 				srcdev);
 			goto leave_with_error;