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

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

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;
-- 
1.7.1

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

Reply via email to