version 1.4, 2009/06/25 22:09:20 |
version 1.5, 2009/06/26 22:12:19 |
|
|
|
|
#include <errno.h> |
#include <errno.h> |
#include <fcntl.h> |
#include <fcntl.h> |
|
#include <paths.h> |
#include <signal.h> |
#include <signal.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
|
|
int |
int |
server_start(char *path) |
server_start(char *path) |
{ |
{ |
int pair[2], srv_fd; |
int pair[2], srv_fd, null_fd; |
char *cause; |
char *cause; |
char rpathbuf[MAXPATHLEN]; |
char rpathbuf[MAXPATHLEN]; |
|
|
|
|
exit(1); |
exit(1); |
} |
} |
logfile("server"); |
logfile("server"); |
|
|
|
/* |
|
* Close stdin/stdout/stderr. Can't let daemon() do this as they are |
|
* needed until now to print configuration file errors. |
|
*/ |
|
if ((null_fd = open(_PATH_DEVNULL, O_RDWR)) != -1) { |
|
dup2(null_fd, STDIN_FILENO); |
|
dup2(null_fd, STDOUT_FILENO); |
|
dup2(null_fd, STDERR_FILENO); |
|
if (null_fd > 2) |
|
close(null_fd); |
|
} |
|
|
log_debug("server started, pid %ld", (long) getpid()); |
log_debug("server started, pid %ld", (long) getpid()); |
log_debug("socket path %s", socket_path); |
log_debug("socket path %s", socket_path); |