git: 9front

Download patch

ref: 52e959a6fcc8c1f7b509d22a61c560cfd63c17eb
parent: 53fe55075b60fe525812388db42b67da3ef48e21
author: Jacob Moody <moody@posixcafe.org>
date: Thu Nov 14 20:06:54 EST 2024

devip: correctly return when allocating an ipmedium slot

Previous patch attempted to panic when we ran out of slots,
however the loop needed changes to return early to avoid
the failure case.

--- a/sys/src/9/ip/ipifc.c
+++ b/sys/src/9/ip/ipifc.c
@@ -103,7 +103,7 @@
 	for(i = 0; i < nelem(media)-1; i++)
 		if(media[i] == nil){
 			media[i] = med;
-			break;
+			return;
 		}
 	panic("addipmedium: too many mediums");
 }
--