aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/newfs_msdos
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-01-05 05:34:14 +0000
committerWarner Losh <imp@FreeBSD.org>2018-01-05 05:34:14 +0000
commit783d8ed04e52b23cf5c76d2ef52b294aa720a613 (patch)
tree3c2c5c25102f283b89d06932f334f6312c3243af /sbin/newfs_msdos
parentb98c75196281d4c18909646b8aa074f31d76e1df (diff)
downloadsrc-783d8ed04e52b23cf5c76d2ef52b294aa720a613.tar.gz
src-783d8ed04e52b23cf5c76d2ef52b294aa720a613.zip
Only call close if fd and fd1 are not -1.
CID: 1384018, 1384017
Notes
Notes: svn path=/head/; revision=327570
Diffstat (limited to 'sbin/newfs_msdos')
-rw-r--r--sbin/newfs_msdos/mkfs_msdos.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/newfs_msdos/mkfs_msdos.c b/sbin/newfs_msdos/mkfs_msdos.c
index 9459db65f04e..7c2e4722eaba 100644
--- a/sbin/newfs_msdos/mkfs_msdos.c
+++ b/sbin/newfs_msdos/mkfs_msdos.c
@@ -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;
}