mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-10 13:18:14 -05:00
Try and fix rendezvous problem
This commit is contained in:
parent
b5d490473a
commit
dd3bc4c731
@ -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);
|
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;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void err_log(int level, unsigned int cat, char *fmt, ...)
|
|||||||
|
|
||||||
err_lock_mutex(); /* atomic file writes */
|
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,"%s",errbuf);
|
||||||
fprintf(stderr,"Aborting\n");
|
fprintf(stderr,"Aborting\n");
|
||||||
fflush(stderr); /* shouldn't have to do this? */
|
fflush(stderr); /* shouldn't have to do this? */
|
||||||
|
@ -927,8 +927,13 @@ int main(int argc, char *argv[]) {
|
|||||||
pthread_join(signal_tid,NULL);
|
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");
|
DPRINTF(E_LOG,L_MAIN|L_WS,"Stopping web server\n");
|
||||||
ws_stop(server);
|
ws_stop(server);
|
||||||
|
*/
|
||||||
|
|
||||||
config_close();
|
config_close();
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <restart.h>
|
#include <restart.h>
|
||||||
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -48,6 +49,7 @@ int rend_pid;
|
|||||||
*/
|
*/
|
||||||
int rend_init(char *user) {
|
int rend_init(char *user) {
|
||||||
int err;
|
int err;
|
||||||
|
int fd;
|
||||||
|
|
||||||
if(pipe((int*)&rend_pipe_to) == -1)
|
if(pipe((int*)&rend_pipe_to) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
@ -81,6 +83,39 @@ int rend_init(char *user) {
|
|||||||
close(rend_pipe_to[WR_SIDE]);
|
close(rend_pipe_to[WR_SIDE]);
|
||||||
close(rend_pipe_from[RD_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
|
/* something bad here... should really signal the parent, rather
|
||||||
* than just zombieizing
|
* than just zombieizing
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user