Use implicit -F for regular files, much like disklabel(8).

This commit is contained in:
pooka 2009-12-17 14:27:49 +00:00
parent 0ab737e1d6
commit 3d1523b600
2 changed files with 12 additions and 4 deletions

View File

@ -1,6 +1,6 @@
.\" $NetBSD: fdisk.8,v 1.67 2009/12/05 16:29:11 pooka Exp $
.\" $NetBSD: fdisk.8,v 1.68 2009/12/17 14:27:49 pooka Exp $
.\"
.Dd November 28, 2009
.Dd December 17, 2009
.Dt FDISK 8
.Os
.Sh NAME
@ -242,6 +242,11 @@ by
will count the 512-byte sectors in
.Ar device
and produce a fake geometry.
If
.Ar device
is a regular file,
.Fl F
will be used implicitly.
.It Fl i
Explicitly request initialisation of the master boot code
(similar to what

View File

@ -1,4 +1,4 @@
/* $NetBSD: fdisk.c,v 1.125 2009/11/04 22:25:56 dsl Exp $ */
/* $NetBSD: fdisk.c,v 1.126 2009/12/17 14:27:49 pooka Exp $ */
/*
* Mach Operating System
@ -39,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fdisk.c,v 1.125 2009/11/04 22:25:56 dsl Exp $");
__RCSID("$NetBSD: fdisk.c,v 1.126 2009/12/17 14:27:49 pooka Exp $");
#endif /* not lint */
#define MBRPTYPENAMES
@ -438,6 +438,9 @@ main(int argc, char *argv[])
initvar_disk(&disk);
}
if (!F_flag && stat(disk, &sb) == 0 && S_ISREG(sb.st_mode))
F_flag = 1;
if (open_disk(B_flag || a_flag || i_flag || u_flag) < 0)
exit(1);