Deleted Added
full compact
newfs_msdos.c (190929) newfs_msdos.c (190930)
1/*
2 * Copyright (c) 1998 Robert Nordier
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef lint
29static const char rcsid[] =
1/*
2 * Copyright (c) 1998 Robert Nordier
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 13 unchanged lines hidden (view full) ---

22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef lint
29static const char rcsid[] =
30 "$FreeBSD: head/sbin/newfs_msdos/newfs_msdos.c 190929 2009-04-11 14:33:10Z ed $";
30 "$FreeBSD: head/sbin/newfs_msdos/newfs_msdos.c 190930 2009-04-11 14:43:22Z ed $";
31#endif /* not lint */
32
33#include <sys/param.h>
34#include <sys/fdcio.h>
35#include <sys/disk.h>
36#include <sys/disklabel.h>
37#include <sys/mount.h>
38#include <sys/stat.h>

--- 319 unchanged lines hidden (view full) ---

358 if (opt_create) {
359 if (opt_N)
360 errx(1, "create (-C) is incompatible with -N");
361 fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, 0644);
362 if (fd == -1)
363 errx(1, "failed to create %s", fname);
364 if (ftruncate(fd, opt_create))
365 errx(1, "failed to initialize %jd bytes", (intmax_t)opt_create);
31#endif /* not lint */
32
33#include <sys/param.h>
34#include <sys/fdcio.h>
35#include <sys/disk.h>
36#include <sys/disklabel.h>
37#include <sys/mount.h>
38#include <sys/stat.h>

--- 319 unchanged lines hidden (view full) ---

358 if (opt_create) {
359 if (opt_N)
360 errx(1, "create (-C) is incompatible with -N");
361 fd = open(fname, O_RDWR | O_CREAT | O_TRUNC, 0644);
362 if (fd == -1)
363 errx(1, "failed to create %s", fname);
364 if (ftruncate(fd, opt_create))
365 errx(1, "failed to initialize %jd bytes", (intmax_t)opt_create);
366 } else if ((fd = open(fname, opt_N ? O_RDONLY : O_RDWR)) == -1 ||
367 fstat(fd, &sb))
366 } else if ((fd = open(fname, opt_N ? O_RDONLY : O_RDWR)) == -1)
368 err(1, "%s", fname);
367 err(1, "%s", fname);
368 if (fstat(fd, &sb))
369 err(1, "%s", fname);
369 if (!opt_N)
370 check_mounted(fname, sb.st_mode);
371 if (!S_ISCHR(sb.st_mode))
372 warnx("warning, %s is not a character device", fname);
373 if (opt_ofs && opt_ofs != lseek(fd, opt_ofs, SEEK_SET))
374 errx(1, "cannot seek to %jd", (intmax_t)opt_ofs);
375 memset(&bpb, 0, sizeof(bpb));
376 if (opt_f) {

--- 633 unchanged lines hidden ---
370 if (!opt_N)
371 check_mounted(fname, sb.st_mode);
372 if (!S_ISCHR(sb.st_mode))
373 warnx("warning, %s is not a character device", fname);
374 if (opt_ofs && opt_ofs != lseek(fd, opt_ofs, SEEK_SET))
375 errx(1, "cannot seek to %jd", (intmax_t)opt_ofs);
376 memset(&bpb, 0, sizeof(bpb));
377 if (opt_f) {

--- 633 unchanged lines hidden ---