summaryrefslogtreecommitdiff
path: root/sbin/fdisk/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/fdisk/misc.c')
-rw-r--r--sbin/fdisk/misc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c
index ad20c5dafee..ae0ecaa2bc3 100644
--- a/sbin/fdisk/misc.c
+++ b/sbin/fdisk/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.20 2008/12/01 20:15:35 ray Exp $ */
+/* $OpenBSD: misc.c,v 1.21 2009/04/07 16:06:37 weingart Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -98,7 +98,12 @@ ask_num(const char *str, int flags, int dflt, int low, int high,
do {
again:
- num = dflt;
+ if (dflt < low)
+ num = low;
+ else if (dflt > high)
+ num = high;
+ else
+ num = dflt;
if (flags == ASK_HEX)
printf("%s [%X - %X]: [%X] ", str, low, high, num);
else