Commit 195ed11f 195ed11f53f9fce1502a22781374a39adcc5e815 by Sean 'Shaleh' Perry

added SO_REUSEADDR socket option

1 parent 251a405a
......@@ -4,6 +4,7 @@ Sean 'Shaleh' Perry <shaleh@debian.org> Wed, 6 Oct 1999 13:55:42 -0700
* changed "w+" to "w" in called to pop3_mainloop():ofile = fdopen()
why was it called with w+? It is only ever used for writing.
* catch EINTR in call to accept() (play nice w/ our UNIX friends)
* set SO_REUSEADDR on daemon's socket
Sean 'Shaleh' Perry <shaleh@debian.org> Tue, 5 Oct 1999 23:06:33 -0700
......
......@@ -303,12 +303,14 @@ pop3_daemon (unsigned int maxchildren)
syslog (LOG_ERR, "socket: %s", strerror(errno));
exit (-1);
}
size = 1; /* use size here to avoid making a new variable */
setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &size, sizeof(size));
size = sizeof(server);
memset (&server, 0, size);
server.sin_family = AF_INET;
server.sin_addr.s_addr = htonl (INADDR_ANY);
server.sin_port = htonl (port);
if (bind(listenfd, (SA *) &server, size) == -1 )
{
syslog(LOG_ERR, "bind: %s", strerror(errno));
......