-/*
- * print_startup - print startup information
- */
-static void
-print_startup(int pid)
-{
- int fd;
-
-#ifndef _WIN32
- close(1);
- fd = open("/dev/null", O_RDWR);
- if (fd == -1) {
- perror("open /dev/null");
- exit(EXIT_FAILURE);
- }
- if (fd == 0)
- fd = dup(fd);
- if (fd != 1)
- abort();
-#endif
- inotice("now running in %s mode from %s as pid %d ...",
- !server_state_foreground ? "background" : "foreground",
- ConfigFileEntry.dpath, pid);
-
-#ifndef _WIN32
- /* let the parent process know the initialization was successful
- * -- jilles */
- if (!server_state_foreground)
- {
- /* GCC complains on Linux if we don't check the value of write pedantically.
- * Technically you're supposed to check the value, yes, but it probably can't fail.
- * No, casting to void is of no use to shut the warning up. You HAVE to use the value.
- * --Elizfaox
- */
- if(write(0, ".", 1) < 1)
- abort();
- }
- if (dup2(1, 0) == -1)
- abort();
- if (dup2(1, 2) == -1)
- abort();
-#endif
-}
-