svn commit: r190930 - head/sbin/newfs_msdos

Ed Schouten ed at FreeBSD.org
Sat Apr 11 14:43:24 UTC 2009


Author: ed
Date: Sat Apr 11 14:43:22 2009
New Revision: 190930
URL: http://svn.freebsd.org/changeset/base/190930

Log:
  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>

Modified:
  head/sbin/newfs_msdos/newfs_msdos.c

Modified: head/sbin/newfs_msdos/newfs_msdos.c
==============================================================================
--- head/sbin/newfs_msdos/newfs_msdos.c	Sat Apr 11 14:33:10 2009	(r190929)
+++ head/sbin/newfs_msdos/newfs_msdos.c	Sat Apr 11 14:43:22 2009	(r190930)
@@ -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);


More information about the svn-src-head mailing list