aboutsummaryrefslogtreecommitdiffstats
path: root/src/unistd/daemonise.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-21 15:38:38 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-21 15:38:38 +0100
commit80ce6dad1e3991b95692960dd3f38c8fc12cd32f (patch)
tree434c6e468549503e018705e5fe1a23927f2ba4c5 /src/unistd/daemonise.c
parentadd getpass (diff)
downloadslibc-80ce6dad1e3991b95692960dd3f38c8fc12cd32f.tar.gz
slibc-80ce6dad1e3991b95692960dd3f38c8fc12cd32f.tar.bz2
slibc-80ce6dad1e3991b95692960dd3f38c8fc12cd32f.tar.xz
in case environ is set to null
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/unistd/daemonise.c')
-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!) */