Only call close if fd and fd1 are not -1.

CID: 1384018, 1384017
This commit is contained in:
Warner Losh 2018-01-05 05:34:14 +00:00
parent b98c751962
commit 783d8ed04e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327570

View File

@ -717,8 +717,10 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
rv = 0;
done:
free(img);
close(fd);
close(fd1);
if (fd != -1)
close(fd);
if (fd1 != -1)
close(fd1);
return rv;
}