aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/unistd/daemonise.c2
1 files changed, 1 insertions, 1 deletions
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!) */