diff --git a/src/configfile.c b/src/configfile.c index 71cd4aa4..9f741f85 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -396,7 +396,6 @@ int config_read(char *file) { DPRINTF(E_LOG,L_CONF,"Must have zlib > 1.2.0 to use gzip content encoding. You have %s. Sucks, huh?\n",ZLIB_VERSION); } - return err; } diff --git a/src/err.c b/src/err.c index c0beb6b0..02ddc7cb 100644 --- a/src/err.c +++ b/src/err.c @@ -118,7 +118,7 @@ void err_log(int level, unsigned int cat, char *fmt, ...) err_lock_mutex(); /* atomic file writes */ - if((!level) && (err_logdestination != LOGDEST_STDERR)) { + if((!level) && (err_logdestination != LOGDEST_STDERR) && (!(cat && L_REND))) { fprintf(stderr,"%s",errbuf); fprintf(stderr,"Aborting\n"); fflush(stderr); /* shouldn't have to do this? */ diff --git a/src/main.c b/src/main.c index 9343979e..d99bcdfb 100644 --- a/src/main.c +++ b/src/main.c @@ -927,8 +927,13 @@ int main(int argc, char *argv[]) { pthread_join(signal_tid,NULL); } + /* Got to find a cleaner way to stop the web server. + * Closing the fd of the socking accepting doesn't necessarily + * cause the accept to fail on some libcs. + * DPRINTF(E_LOG,L_MAIN|L_WS,"Stopping web server\n"); ws_stop(server); + */ config_close(); diff --git a/src/rend-unix.c b/src/rend-unix.c index 7d2930fb..9b4afcac 100644 --- a/src/rend-unix.c +++ b/src/rend-unix.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,7 @@ int rend_pid; */ int rend_init(char *user) { int err; + int fd; if(pipe((int*)&rend_pipe_to) == -1) return -1; @@ -80,6 +82,39 @@ int rend_init(char *user) { /* child */ close(rend_pipe_to[WR_SIDE]); close(rend_pipe_from[RD_SIDE]); + + /* Depending on the backend, this might not get done on the + * rendezvous server-specific side + */ + signal(SIGTTOU, SIG_IGN); + signal(SIGTTIN, SIG_IGN); + signal(SIGTSTP, SIG_IGN); + +#ifdef SETPGRP_VOID + setpgrp(); +#else + setpgrp(0,0); +#endif + +#ifdef TIOCNOTTY + if ((fd = open("/dev/tty", O_RDWR)) >= 0) { + ioctl(fd, TIOCNOTTY, (char *) NULL); + close(fd); + } +#endif + + if((fd = open("/dev/null", O_RDWR, 0)) != -1) { + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + if (fd > 2) + close(fd); + } + + errno = 0; + + chdir("/"); + umask(0); /* something bad here... should really signal the parent, rather * than just zombieizing