Hi again, upstream solved this issue [1], [2] by always closing stdin/stdout/stderr when daemonizing.
Please find attached a git commit against your tag debian/1%2.15-2 adding a quilt patch. Cheers Daniel [1] https://github.com/reubenhwk/radvd/pull/72 [2] https://github.com/reubenhwk/radvd/commit/5cfc48b9ed75eb5f5e127b0d24a18b728b20e9af
From 47e162d9c75253abef86e25a41808ab5230a3168 Mon Sep 17 00:00:00 2001 From: Daniel Reichelt <deb...@nachtgeist.net> Date: Sun, 2 Jul 2017 12:21:18 +0200 Subject: [PATCH] add patch to always close STD* FDs on daemonizing fixes #865795 --- ...ose_std_file_descriptors_when_daemonizing.patch | 81 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 82 insertions(+) create mode 100644 debian/patches/always_close_std_file_descriptors_when_daemonizing.patch diff --git a/debian/patches/always_close_std_file_descriptors_when_daemonizing.patch b/debian/patches/always_close_std_file_descriptors_when_daemonizing.patch new file mode 100644 index 0000000..4a6e291 --- /dev/null +++ b/debian/patches/always_close_std_file_descriptors_when_daemonizing.patch @@ -0,0 +1,81 @@ +Index: radvd/radvd.c +=================================================================== +--- radvd.orig/radvd.c ++++ radvd/radvd.c +@@ -82,7 +82,7 @@ static int check_conffile_perm(const cha + static int drop_root_privileges(const char *); + static int open_and_lock_pid_file(char const * daemon_pid_file_ident); + static int write_pid_file(char const * daemon_pid_file_ident, pid_t pid); +-static pid_t daemonp(int nochdir, int noclose, char const * daemon_pid_file_ident); ++static pid_t daemonp(char const * daemon_pid_file_ident); + static pid_t do_daemonize(int log_method, char const * daemon_pid_file_ident); + static struct Interface * main_loop(int sock, struct Interface *ifaces, char const *conf_path); + static struct Interface *reload_config(int sock, struct Interface *ifaces, char const *conf_path); +@@ -106,7 +106,7 @@ static void version(void); + /* daemonize and write pid file. The pid of the daemon child process + * will be written to the pid file from the *parent* process. This + * insures there is no race condition as described in redhat bug 664783. */ +-static pid_t daemonp(int nochdir, int noclose, char const * daemon_pid_file_ident) ++static pid_t daemonp(char const * daemon_pid_file_ident) + { + int pipe_ends[2]; + +@@ -138,28 +138,24 @@ static pid_t daemonp(int nochdir, int no + exit(-1); + } + +- if (nochdir == 0) { +- if (chdir("/") == -1) { +- perror("chdir"); +- exit(1); +- } ++ if (chdir("/") == -1) { ++ perror("chdir"); ++ exit(1); + } +- if (noclose == 0) { +- close(STDIN_FILENO); +- close(STDOUT_FILENO); +- close(STDERR_FILENO); +- if (open("/dev/null", O_RDONLY) == -1) { +- flog(LOG_ERR, "unable to redirect stdin to /dev/null"); +- exit(-1); +- } +- if (open("/dev/null", O_WRONLY) == -1) { +- flog(LOG_ERR, "unable to redirect stdout to /dev/null"); +- exit(-1); +- } +- if (open("/dev/null", O_RDWR) == -1) { +- flog(LOG_ERR, "unable to redirect stderr to /dev/null"); +- exit(-1); +- } ++ close(STDIN_FILENO); ++ close(STDOUT_FILENO); ++ close(STDERR_FILENO); ++ if (open("/dev/null", O_RDONLY) == -1) { ++ flog(LOG_ERR, "unable to redirect stdin to /dev/null"); ++ exit(-1); ++ } ++ if (open("/dev/null", O_WRONLY) == -1) { ++ flog(LOG_ERR, "unable to redirect stdout to /dev/null"); ++ exit(-1); ++ } ++ if (open("/dev/null", O_RDWR) == -1) { ++ flog(LOG_ERR, "unable to redirect stderr to /dev/null"); ++ exit(-1); + } + } else { + /* Parent. Make sure the pid file is written before exiting. */ +@@ -591,11 +587,7 @@ static pid_t do_daemonize(int log_method + { + pid_t pid = -1; + +- if (L_STDERR_SYSLOG == log_method || L_STDERR == log_method) { +- pid = daemonp(1, 1, daemon_pid_file_ident); +- } else { +- pid = daemonp(0, 0, daemon_pid_file_ident); +- } ++ pid = daemonp(daemon_pid_file_ident); + + if (-1 == pid) { + flog(LOG_ERR, "unable to daemonize: %s", strerror(errno)); diff --git a/debian/patches/series b/debian/patches/series index 33ebe29..287f3b1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ # so cleaning up the debian/patches/ directory # kfreebsd.patch +always_close_std_file_descriptors_when_daemonizing.patch -- 2.11.0
signature.asc
Description: OpenPGP digital signature