- Fixed a /RESTART issue on Linux: Unreal did not properly close all file-

descriptors. Because of this, Unreal did not restart properly as you would
  get an "Address already in use" error. This only seemed to happen when
  logging to syslog.
- Fixed a similar issue with syslog (and debugmode) and closing fd's as well:
  the first port we listened on would not open up, ircd did not log any error.
This commit is contained in:
Bram Matthys 2010-01-04 13:11:03 +00:00
parent 6b28bfd1b7
commit 7ad6dcd977
3 changed files with 13 additions and 2 deletions

View file

@ -1894,3 +1894,9 @@
not exist, it now asks you if you want to automatically download and
install curl (which is done by ./curlinstall).
This has been tested on Linux, further testing on f.e. FreeBSD is required.
- Fixed a /RESTART issue on Linux: Unreal did not properly close all file-
descriptors. Because of this, Unreal did not restart properly as you would
get an "Address already in use" error. This only seemed to happen when
logging to syslog.
- Fixed a similar issue with syslog (and debugmode) and closing fd's as well:
the first port we listened on would not open up, ircd did not log any error.

View file

@ -361,8 +361,7 @@ void server_reboot(char *mesg)
if (!(bootopt & (BOOT_TTY | BOOT_DEBUG)))
(void)close(2);
(void)close(1);
if ((bootopt & BOOT_CONSOLE) || isatty(0))
(void)close(0);
(void)close(0);
(void)execv(MYNAME, myargv);
#else
close_connections();

View file

@ -605,6 +605,9 @@ char logbuf[BUFSIZ];
# endif
#endif
#ifndef _WIN32
#ifdef HAVE_SYSLOG
closelog(); /* temporary close syslog, as we mass close() fd's below... */
#endif
#ifndef NOCLOSEFD
for (fd = 3; fd < MAXCONNECTIONS; fd++)
{
@ -655,6 +658,9 @@ init_dgram:
close(fileno(stdout));
if (!(bootopt & BOOT_DEBUG))
close(fileno(stderr));
#endif
#ifdef HAVE_SYSLOG
openlog("ircd", LOG_PID | LOG_NDELAY, LOG_DAEMON); /* reopened now */
#endif
memset(local, 0, sizeof(aClient*) * MAXCONNECTIONS);
LastSlot = -1;