Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/fdisk Fix parsing of -A option so that the [/ptn_0_offs...



details:   https://anonhg.NetBSD.org/src/rev/40b52ceca23c
branches:  trunk
changeset: 764842:40b52ceca23c
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun May 08 14:22:16 2011 +0000

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

diffstat:

 sbin/fdisk/fdisk.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 94db8869cfb0 -r 40b52ceca23c sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c        Sun May 08 13:51:31 2011 +0000
+++ b/sbin/fdisk/fdisk.c        Sun May 08 14:22:16 2011 +0000
@@ -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.");



Home | Main Index | Thread Index | Old Index