Module Name:    src
Committed By:   pgoyette
Date:           Sun May  8 14:22:16 UTC 2011

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

Log Message:
Fix parsing of -A option so that the [/ptn_0_offset] part is optional, as
described in the man page.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 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.c
diff -u src/sbin/fdisk/fdisk.c:1.130 src/sbin/fdisk/fdisk.c:1.131
--- src/sbin/fdisk/fdisk.c:1.130	Wed Dec 23 18:50:40 2009
+++ src/sbin/fdisk/fdisk.c	Sun May  8 14:22:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdisk.c,v 1.130 2009/12/23 18:50:40 dsl Exp $ */
+/*	$NetBSD: fdisk.c,v 1.131 2011/05/08 14:22:16 pgoyette Exp $ */
 
 /*
  * Mach Operating System
@@ -39,7 +39,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.130 2009/12/23 18:50:40 dsl Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.131 2011/05/08 14:22:16 pgoyette Exp $");
 #endif /* not lint */
 
 #define MBRPTYPENAMES
@@ -418,8 +418,8 @@
 				b_cyl = MAXCYL;
 			break;
 		case 'A':	/* Partition alignment[/offset] */
-			if (sscanf(optarg, "%u/%u%n", &ptn_alignment,
-				    &ptn_0_offset, &n) < 1
+			if (sscanf(optarg, "%u%n/%u%n", &ptn_alignment,
+				    &n, &ptn_0_offset, &n) < 1
 			    || optarg[n] != 0
 			    || ptn_0_offset > ptn_alignment)
 				errx(1, "Bad argument to the -A flag.");

Reply via email to