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.
This commit is contained in:
Benjamin Riefenstahl 2022-06-10 16:02:13 +00:00 committed by Ori Bernstein
parent 0ec0154bc9
commit 9fc38d43d4

View file

@ -56,10 +56,7 @@ bind(int fd, void *a, int alen)
return -1; return -1;
} }
port = _sock_inport(&r->addr); port = _sock_inport(&r->addr);
if(port > 0)
snprintf(msg, sizeof msg, "bind %d", port); snprintf(msg, sizeof msg, "bind %d", port);
else
strcpy(msg, "bind *");
n = write(cfd, msg, strlen(msg)); n = write(cfd, msg, strlen(msg));
if(n < 0){ if(n < 0){
errno = EOPNOTSUPP; /* Improve error reporting!!! */ errno = EOPNOTSUPP; /* Improve error reporting!!! */