code: plan9front

Download patch

ref: 9fc38d43d45185c25cf74361b4bb778c611b015d
parent: 0ec0154bc9da3c0b48f2f2cae08347129a8ec3d4
author: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
date: Fri Jun 10 12:02:13 EDT 2022

ape/bsd/bind.c: Do not issue "bind *".

Despite the documentation, "bind *" is invalid and gives the error
"bad numeric port" in devip.c:setladdrport.

"bind 0" OTOH is actually supported fine in the Plan9 API and has the
right sematics.

--- a/sys/src/ape/lib/bsd/bind.c
+++ b/sys/src/ape/lib/bsd/bind.c
@@ -56,10 +56,7 @@
 		return -1;
 	}
 	port = _sock_inport(&r->addr);
-	if(port > 0)
-		snprintf(msg, sizeof msg, "bind %d", port);
-	else
-		strcpy(msg, "bind *");
+	snprintf(msg, sizeof msg, "bind %d", port);
 	n = write(cfd, msg, strlen(msg));
 	if(n < 0){
 		errno = EOPNOTSUPP;	/* Improve error reporting!!! */