btrfs-progs: don't close(-1)
authorZach Brown <zab@redhat.com>
Tue, 22 Jan 2013 01:11:28 +0000 (17:11 -0800)
committerZach Brown <zab@redhat.com>
Wed, 6 Feb 2013 00:09:39 +0000 (16:09 -0800)
When opening the fd fails just return instead of taking the shared error
path that tries to close() the fd.

Signed-off-by: Zach Brown <zab@redhat.com>
mkfs.c

diff --git a/mkfs.c b/mkfs.c
index 0eee8b5..0c9eebf 100644 (file)
--- a/mkfs.c
+++ b/mkfs.c
@@ -782,7 +782,7 @@ static int add_file_items(struct btrfs_trans_handle *trans,
        fd = open(path_name, O_RDONLY);
        if (fd == -1) {
                fprintf(stderr, "%s open failed\n", path_name);
-               goto end;
+               return ret;
        }
 
        blocks = st->st_size / sectorsize;