ircd: handle some EXIT_FAILURE cases differently on win32

This commit is contained in:
William Pitcock 2016-03-20 03:06:14 -05:00
parent 48c6d0f56c
commit c1bfea7332

View file

@ -156,6 +156,7 @@ print_startup(int pid)
{ {
int fd; int fd;
#ifndef _WIN32
close(1); close(1);
fd = open("/dev/null", O_RDWR); fd = open("/dev/null", O_RDWR);
if (fd == -1) { if (fd == -1) {
@ -166,11 +167,13 @@ print_startup(int pid)
fd = dup(fd); fd = dup(fd);
if (fd != 1) if (fd != 1)
abort(); abort();
#endif
inotice("now running in %s mode from %s as pid %d ...", inotice("now running in %s mode from %s as pid %d ...",
!server_state_foreground ? "background" : "foreground", !server_state_foreground ? "background" : "foreground",
ConfigFileEntry.dpath, pid); ConfigFileEntry.dpath, pid);
#ifndef _WIN32
/* let the parent process know the initialization was successful /* let the parent process know the initialization was successful
* -- jilles */ * -- jilles */
if (!server_state_foreground) if (!server_state_foreground)
@ -181,6 +184,7 @@ print_startup(int pid)
abort(); abort();
if (dup2(1, 2) == -1) if (dup2(1, 2) == -1)
abort(); abort();
#endif
} }
/* /*
@ -193,7 +197,7 @@ print_startup(int pid)
static void static void
init_sys(void) init_sys(void)
{ {
#if defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H) #if !defined(_WIN32) && defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H)
struct rlimit limit; struct rlimit limit;
if(!getrlimit(RLIMIT_NOFILE, &limit)) if(!getrlimit(RLIMIT_NOFILE, &limit))