mirror of https://github.com/getdnsapi/getdns.git
Ignore SIGPIPE signal (for not suddenly stopping)
This commit is contained in:
parent
6f20016889
commit
260416a859
|
@ -46,6 +46,10 @@ typedef unsigned short in_port_t;
|
||||||
#include <wincrypt.h>
|
#include <wincrypt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SIGNAL_H
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GETDNS_YAML2DICT
|
#ifdef HAVE_GETDNS_YAML2DICT
|
||||||
getdns_return_t getdns_yaml2dict(const char *, getdns_dict **dict);
|
getdns_return_t getdns_yaml2dict(const char *, getdns_dict **dict);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1794,27 +1798,10 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
else if (listen_count) {
|
else if (listen_count) {
|
||||||
assert(loop);
|
assert(loop);
|
||||||
#ifndef GETDNS_ON_WINDOWS
|
#ifdef SIGPIPE
|
||||||
if (i_am_stubby && !run_in_foreground) {
|
(void) signal(SIGPIPE, SIG_IGN);
|
||||||
pid_t pid = fork();
|
|
||||||
if (pid == -1) {
|
|
||||||
perror("Could not fork of stubby daemon\n");
|
|
||||||
r = GETDNS_RETURN_GENERIC_ERROR;
|
|
||||||
|
|
||||||
} else if (pid) {
|
|
||||||
FILE *fh = fopen("/var/rub/stubby.pid", "w");
|
|
||||||
if (! fh)
|
|
||||||
fh = fopen("/tmp/stubby.pid", "w");
|
|
||||||
if (fh) {
|
|
||||||
fprintf(fh, "%d", (int)pid);
|
|
||||||
fclose(fh);
|
|
||||||
batch_mode = 0;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
loop->vmt->run(loop);
|
|
||||||
} else
|
|
||||||
#endif
|
#endif
|
||||||
loop->vmt->run(loop);
|
loop->vmt->run(loop);
|
||||||
} else
|
} else
|
||||||
r = do_the_call();
|
r = do_the_call();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue