9fans archive / 1996 / 09 / 3 /    prev next

From: scott@ang... scott@ang...
Subject: No subject
Date: Mon, 2 Sep 1996 00:16:19 EDT

One more ape bug...  A common unix idiom is bind followed by listen.
In ape, bind sets the socket's port, and but listen also tries to do
that.  To avoid an error in that case, I propose listen.c:139 be 
modified as follows:

		if(lip->sin_port >= 0) {
			if (write(cfd, "bind 0", 6) < 0) {
				errno = EGREG;
				close(cfd);
				return -1;
			}
			sprintf(msg, "announce %d", ntohs(lip->sin_port));