diff options
Diffstat (limited to 'meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch')
| -rw-r--r-- | meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch b/meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch new file mode 100644 index 0000000000..c2757a2fb7 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/babel-close-the-stdout-stderr-as-in-other-daemons.patch | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | From ba71f768e6dbb1f2ac72ed3bd880bff75a48d345 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Roy Li <rongqing.li@windriver.com> | ||
| 3 | Date: Wed, 19 Feb 2014 14:13:40 +0800 | ||
| 4 | Subject: [PATCH] babeld: close stdout once the background daemon is created | ||
| 5 | |||
| 6 | Upstream-Status: pending | ||
| 7 | |||
| 8 | Once babald becomes a background daemon, it should not output information to | ||
| 9 | stdout, so need to close stdout. | ||
| 10 | |||
| 11 | In fact, other daemons close their stdout when they run into background, like | ||
| 12 | ospfd, isisd and bgpd, by calling daemon() which is in lib/daemon.c | ||
| 13 | |||
| 14 | Closing the stdout can fix a tee hang issue { #/usr/sbin/babeld -d |tee tmp } | ||
| 15 | |||
| 16 | Signed-off-by: Roy Li <rongqing.li@windriver.com> | ||
| 17 | --- | ||
| 18 | babeld/util.c | 10 +++++++++- | ||
| 19 | 1 file changed, 9 insertions(+), 1 deletion(-) | ||
| 20 | |||
| 21 | diff --git a/babeld/util.c b/babeld/util.c | ||
| 22 | index 011f382..76203bc 100644 | ||
| 23 | --- a/babeld/util.c | ||
| 24 | +++ b/babeld/util.c | ||
| 25 | @@ -425,7 +425,7 @@ uchar_to_in6addr(struct in6_addr *dest, const unsigned char *src) | ||
| 26 | int | ||
| 27 | daemonise() | ||
| 28 | { | ||
| 29 | - int rc; | ||
| 30 | + int rc, fd; | ||
| 31 | |||
| 32 | fflush(stdout); | ||
| 33 | fflush(stderr); | ||
| 34 | @@ -441,5 +441,13 @@ daemonise() | ||
| 35 | if(rc < 0) | ||
| 36 | return -1; | ||
| 37 | |||
| 38 | + fd = open("/dev/null", O_RDWR, 0); | ||
| 39 | + if (fd != -1) | ||
| 40 | + { | ||
| 41 | + dup2(fd, STDOUT_FILENO); | ||
| 42 | + if (fd > 2) | ||
| 43 | + close(fd); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | return 1; | ||
| 47 | } | ||
| 48 | -- | ||
| 49 | 1.7.10.4 | ||
| 50 | |||
