shithub: front

Download patch

ref: 6b8c36d51f8c68b94f6f3a8712070a924927d677
parent: 3f7a323e31ddc5989de00d86e3dab6cd6929c00c
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");
 }
--