Try and fix rendezvous problem

This commit is contained in:
Ron Pedde 2005-01-07 05:37:46 +00:00
parent b5d490473a
commit dd3bc4c731
4 changed files with 41 additions and 2 deletions

View File

@ -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;
}

View File

@ -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? */

View File

@ -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();

View File

@ -25,6 +25,7 @@
#include <errno.h>
#include <restart.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -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