svn commit: r190931 - head/sbin/newfs_msdos

Ed Schouten ed at FreeBSD.org
Sat Apr 11 14:53:33 UTC 2009


Author: ed
Date: Sat Apr 11 14:53:32 2009
New Revision: 190931
URL: http://svn.freebsd.org/changeset/base/190931

Log:
  When using -C, do not warn when the file is not a character device, but warn when it is not a regular file.
  
  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:43:22 2009	(r190930)
+++ head/sbin/newfs_msdos/newfs_msdos.c	Sat Apr 11 14:53:32 2009	(r190931)
@@ -367,10 +367,15 @@ main(int argc, char *argv[])
 	err(1, "%s", fname);
     if (fstat(fd, &sb))
 	err(1, "%s", fname);
+    if (opt_create) {
+	if (!S_ISREG(sb.st_mode))
+	    warnx("warning, %s is not a regular file", fname);
+    } else {
+	if (!S_ISCHR(sb.st_mode))
+	    warnx("warning, %s is not a character device", fname);
+    }
     if (!opt_N)
 	check_mounted(fname, sb.st_mode);
-    if (!S_ISCHR(sb.st_mode))
-	warnx("warning, %s is not a character device", fname);
     if (opt_ofs && opt_ofs != lseek(fd, opt_ofs, SEEK_SET))
 	errx(1, "cannot seek to %jd", (intmax_t)opt_ofs);
     memset(&bpb, 0, sizeof(bpb));


More information about the svn-src-all mailing list