summaryrefslogtreecommitdiffstats
path: root/sbin/newfs_msdos
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-04-11 14:43:22 +0000
committered <ed@FreeBSD.org>2009-04-11 14:43:22 +0000
commit98e7a432a78d3ec0e6cbeb9fea11b9e68612150a (patch)
tree705da2cdbf9cdacc1941346eebacc4eea557a019 /sbin/newfs_msdos
parent9f361d5f3eaa36786458891796c4d1c7df17212c (diff)
downloadFreeBSD-src-98e7a432a78d3ec0e6cbeb9fea11b9e68612150a.zip
FreeBSD-src-98e7a432a78d3ec0e6cbeb9fea11b9e68612150a.tar.gz
Fix a bug in r185587.
fstat(fd, &sb) was not executed unconditionally anymore so sb was read uninitialised when -C is used. Submitted by: Christoph Mallon <christoph mallon gmx de>
Diffstat (limited to 'sbin/newfs_msdos')
-rw-r--r--sbin/newfs_msdos/newfs_msdos.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c
index 0b78771..d10474c 100644
--- a/sbin/newfs_msdos/newfs_msdos.c
+++ b/sbin/newfs_msdos/newfs_msdos.c
@@ -363,8 +363,9 @@ main(int argc, char *argv[])
errx(1, "failed to create %s", fname);
if (ftruncate(fd, opt_create))
errx(1, "failed to initialize %jd bytes", (intmax_t)opt_create);
- } else if ((fd = open(fname, opt_N ? O_RDONLY : O_RDWR)) == -1 ||
- fstat(fd, &sb))
+ } else if ((fd = open(fname, opt_N ? O_RDONLY : O_RDWR)) == -1)
+ err(1, "%s", fname);
+ if (fstat(fd, &sb))
err(1, "%s", fname);
if (!opt_N)
check_mounted(fname, sb.st_mode);
OpenPOWER on IntegriCloud