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>
This commit is contained in:
Ed Schouten 2009-04-11 14:43:22 +00:00
parent 18a064438f
commit f069c0aff0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190930

View File

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