summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2011-03-05 06:50:41 +0000
committerkrw <krw@openbsd.org>2011-03-05 06:50:41 +0000
commita243d7b51ea26ae920fe2660a97cbf5047cbd1aa (patch)
tree8d42ec0782c57da3054553cc4e61beba5102a69f
parentThe function pf_tag_packet() never fails. Remove a redundant check (diff)
downloadwireguard-openbsd-a243d7b51ea26ae920fe2660a97cbf5047cbd1aa.tar.xz
wireguard-openbsd-a243d7b51ea26ae920fe2660a97cbf5047cbd1aa.zip
If an auto-allocation scheme fails because there are not enough
available partitions (e.g. many spoofed logical partitions) try the next scheme rather than giving up. "sane" deraadt@ ok matthew@
-rw-r--r--sbin/disklabel/editor.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index e34657af2f9..04b96829101 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.249 2011/03/02 04:48:24 krw Exp $ */
+/* $OpenBSD: editor.c,v 1.250 2011/03/05 06:50:41 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -587,8 +587,14 @@ again:
for (j = 0; j < MAXPARTITIONS; j++)
if (DL_GETPSIZE(&lp->d_partitions[j]) == 0)
break;
- if (j == MAXPARTITIONS)
- return;
+ if (j == MAXPARTITIONS) {
+ /* It did not work out, try next strategy */
+ free(alloc);
+ if (++index < nitems(alloc_table))
+ goto again;
+ else
+ return;
+ }
partno = j;
pp = &lp->d_partitions[j];
partmp = &mountpoints[j];