Module Name:    src
Committed By:   pooka
Date:           Thu Dec 17 14:27:49 UTC 2009

Modified Files:
        src/sbin/fdisk: fdisk.8 fdisk.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sbin/fdisk/fdisk.8
cvs rdiff -u -r1.125 -r1.126 src/sbin/fdisk/fdisk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/fdisk/fdisk.8
diff -u src/sbin/fdisk/fdisk.8:1.67 src/sbin/fdisk/fdisk.8:1.68
--- src/sbin/fdisk/fdisk.8:1.67	Sat Dec  5 16:29:11 2009
+++ src/sbin/fdisk/fdisk.8	Thu Dec 17 14:27:49 2009
@@ -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 @@
 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

Index: src/sbin/fdisk/fdisk.c
diff -u src/sbin/fdisk/fdisk.c:1.125 src/sbin/fdisk/fdisk.c:1.126
--- src/sbin/fdisk/fdisk.c:1.125	Wed Nov  4 22:25:56 2009
+++ src/sbin/fdisk/fdisk.c	Thu Dec 17 14:27:49 2009
@@ -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 @@
 		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);
 

Reply via email to