summaryrefslogtreecommitdiffstats
path: root/sbin/disklabel/editor.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2009-05-17 01:06:56 +0000
committerkrw <krw@openbsd.org>2009-05-17 01:06:56 +0000
commit3d98fc8ce40d1b0872077eeddcc18303be009cbe (patch)
tree10c1eef7e7c0452f4b280c6814a6831caddbf73a /sbin/disklabel/editor.c
parentdo not hardcode the version into the script; ok krw miod (diff)
downloadwireguard-openbsd-3d98fc8ce40d1b0872077eeddcc18303be009cbe.tar.xz
wireguard-openbsd-3d98fc8ce40d1b0872077eeddcc18303be009cbe.zip
Initialize mountpoints[] when going past again:, since a
smaller alloc table will have fewer mountpoints and the extras cause confusion. And any info from '/etc/fstab' that was loaded into mountpoints needs to be zapped too. Noticed by jim@
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r--sbin/disklabel/editor.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index c42544a636c..3093058a0c1 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.209 2009/05/13 17:02:46 deraadt Exp $ */
+/* $OpenBSD: editor.c,v 1.210 2009/05/17 01:06:56 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -17,7 +17,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.209 2009/05/13 17:02:46 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.210 2009/05/17 01:06:56 krw Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -530,6 +530,10 @@ editor_allocspace(struct disklabel *lp_org)
cylsecs = lp_org->d_secpercyl;
again:
lp = &label;
+ for (i=0; i<MAXPARTITIONS; i++) {
+ free(mountpoints[i]);
+ mountpoints[i] = NULL;
+ }
memcpy(lp, lp_org, sizeof(struct disklabel));
lp->d_npartitions = MAXPARTITIONS;
lastalloc = alloc_table[index].sz;