From 80ce6dad1e3991b95692960dd3f38c8fc12cd32f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 21 Dec 2015 15:38:38 +0100 Subject: in case environ is set to null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/unistd/daemonise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unistd/daemonise.c b/src/unistd/daemonise.c index c43f114..73ad4f8 100644 --- a/src/unistd/daemonise.c +++ b/src/unistd/daemonise.c @@ -167,7 +167,7 @@ int daemonise(const char* name, int flags) /* TODO user-private daemons */ } /* Remove malformatted environment entires. */ - if ((flags & DAEMONISE_KEEP_ENVIRON) == 0) + if (((flags & DAEMONISE_KEEP_ENVIRON) == 0) && (environ != NULL)) { for (r = w = environ; *r; r++) if (strchr(*r, '=')) /* It happens that this is not the case! (Thank you PAM!) */ -- cgit v1.2.3-70-g09d2