From patchwork Mon Feb 25 22:54:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 2182071 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3F1BADF230 for ; Mon, 25 Feb 2013 21:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759702Ab3BYVzX (ORCPT ); Mon, 25 Feb 2013 16:55:23 -0500 Received: from nat-pool-rdu.redhat.com ([66.187.233.202]:43994 "EHLO bp-05.lab.msp.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758699Ab3BYVzR (ORCPT ); Mon, 25 Feb 2013 16:55:17 -0500 Received: by bp-05.lab.msp.redhat.com (Postfix, from userid 0) id 917251E0A96; Mon, 25 Feb 2013 16:54:54 -0600 (CST) From: Eric Sandeen To: linux-btrfs@vger.kernel.org Cc: Eric Sandeen Subject: [PATCH 06/17] btrfs-progs: fix open error test in cmd_start_replace Date: Mon, 25 Feb 2013 16:54:39 -0600 Message-Id: <1361832890-40921-7-git-send-email-sandeen@redhat.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1361832890-40921-1-git-send-email-sandeen@redhat.com> References: <1361832890-40921-1-git-send-email-sandeen@redhat.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org open() returns a negative fd on failure, not 0. Signed-off-by: Eric Sandeen --- 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;