diff options
author | ed <ed@FreeBSD.org> | 2009-04-11 14:53:32 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-04-11 14:53:32 +0000 |
commit | ac65054d3a51a5c569eb674940555b51f7da64e0 (patch) | |
tree | 7327b3c28ec925507b1b6120a94bdd30f2939beb /sbin/newfs_msdos | |
parent | 98e7a432a78d3ec0e6cbeb9fea11b9e68612150a (diff) | |
download | FreeBSD-src-ac65054d3a51a5c569eb674940555b51f7da64e0.zip FreeBSD-src-ac65054d3a51a5c569eb674940555b51f7da64e0.tar.gz |
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>
Diffstat (limited to 'sbin/newfs_msdos')
-rw-r--r-- | sbin/newfs_msdos/newfs_msdos.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sbin/newfs_msdos/newfs_msdos.c b/sbin/newfs_msdos/newfs_msdos.c index d10474c..091cf4c 100644 --- a/sbin/newfs_msdos/newfs_msdos.c +++ b/sbin/newfs_msdos/newfs_msdos.c @@ -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)); |