summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-10-26 21:39:22 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-10-26 21:39:22 +0000
commit66882baaaab594482c391178b1860923d95c8425 (patch)
tree47f6d711730fe232fe08678ef6ca3ca1a0b08c9e /sbin
parent9774188bc52630725867f3fd9ab30b1678f38300 (diff)
fix partition selection to allow all partitions to be grown.
report by Mitja Muzenic <mitja at muzenic.net>
Diffstat (limited to 'sbin')
-rw-r--r--sbin/growfs/Makefile5
-rw-r--r--sbin/growfs/growfs.c10
2 files changed, 10 insertions, 5 deletions
diff --git a/sbin/growfs/Makefile b/sbin/growfs/Makefile
index 3aef04506e2..1e04649aea2 100644
--- a/sbin/growfs/Makefile
+++ b/sbin/growfs/Makefile
@@ -2,7 +2,7 @@
#
# $TSHeader: src/sbin/growfs/Makefile,v 1.4 2000/12/05 19:45:24 tomsoft Exp $
# $FreeBSD: src/sbin/growfs/Makefile,v 1.4 2001/12/04 02:19:47 obrien Exp $
-# $OpenBSD: Makefile,v 1.2 2003/08/07 16:37:52 fgsch Exp $
+# $OpenBSD: Makefile,v 1.3 2003/10/26 21:39:21 tedu Exp $
#
PROG= growfs
@@ -11,6 +11,9 @@ MAN= growfs.8
CFLAGS+=-Wall
+DPADD= ${LIBUTIL}
+LDADD= -lutil
+
.if defined(GFSDBG)
SRCS+= debug.c
CFLAGS+=-DFS_DEBUG
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index 228501f2f36..db0ba8d3616 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: growfs.c,v 1.7 2003/10/14 05:23:30 drahn Exp $ */
+/* $OpenBSD: growfs.c,v 1.8 2003/10/26 21:39:21 tedu Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
@@ -46,7 +46,7 @@ static const char copyright[] =
Copyright (c) 1980, 1989, 1993 The Regents of the University of California.\n\
All rights reserved.\n";
-static const char rcsid[] = "$OpenBSD: growfs.c,v 1.7 2003/10/14 05:23:30 drahn Exp $";
+static const char rcsid[] = "$OpenBSD: growfs.c,v 1.8 2003/10/26 21:39:21 tedu Exp $";
#endif /* not lint */
/* ********************************************************** INCLUDES ***** */
@@ -63,6 +63,8 @@ static const char rcsid[] = "$OpenBSD: growfs.c,v 1.7 2003/10/14 05:23:30 drahn
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <util.h>
+
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
@@ -1940,8 +1942,8 @@ main(int argc, char **argv)
cp = device + strlen(device)-1;
lp = get_disklabel(fsi);
if (isdigit(*cp))
- pp = &lp->d_partitions[2];
- else if (*cp>='a' && *cp<='h')
+ pp = &lp->d_partitions[0];
+ else if (*cp >= 'a' && *cp < 'a' + getmaxpartitions())
pp = &lp->d_partitions[*cp - 'a'];
else
errx(1, "unknown device");