btrfs-progs: don't close(-1)

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>
This commit is contained in:
Zach Brown 2013-01-21 17:11:28 -08:00
parent da3a185f44
commit ac59571f59

2
mkfs.c
View File

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