btrfs-progs: fix open error test in cmd_start_replace

open() returns a negative fd on failure, not 0.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
Eric Sandeen 2013-02-25 16:54:39 -06:00 committed by David Sterba
parent bbf1919b00
commit 67c631329a

View File

@ -235,7 +235,7 @@ static int cmd_start_replace(int argc, char **argv)
} }
} else { } else {
fdsrcdev = open(srcdev, O_RDWR); fdsrcdev = open(srcdev, O_RDWR);
if (!fdsrcdev) { if (fdsrcdev < 0) {
fprintf(stderr, "Error: Unable to open device '%s'\n", fprintf(stderr, "Error: Unable to open device '%s'\n",
srcdev); srcdev);
goto leave_with_error; goto leave_with_error;