X-Git-Url: https://ruderich.org/simon/gitweb/?p=coloredstderr%2Fcoloredstderr.git;a=blobdiff_plain;f=src%2Fcoloredstderr.c;h=9161fc34f3deff694dba52eb07923fdde19bc4c2;hp=f1f2599927eb99130947afdd4f272ef86f9b305a;hb=f78c0377c1fc1862aaa4103fc6de6cfbe3fd0725;hpb=8a65b4486febf00e3fad5bafc3773a811e675a4c diff --git a/src/coloredstderr.c b/src/coloredstderr.c index f1f2599..9161fc3 100644 --- a/src/coloredstderr.c +++ b/src/coloredstderr.c @@ -2,7 +2,7 @@ * Hook output functions (like printf(3)) with LD_PRELOAD to color stderr (or * other file descriptors). * - * Copyright (C) 2013-2015 Simon Ruderich + * Copyright (C) 2013-2018 Simon Ruderich * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -554,6 +554,11 @@ pid_t vfork(void) { HOOK_FUNC_DEF3(int, execve, char const *, filename, char * const *, argv, char * const *, env) { DLSYM_FUNCTION(real_execve, "execve"); + char * const fake_env[] = {NULL}; + if (env == NULL) { + env = fake_env; + } + /* Count environment variables. */ size_t count = 0; char * const *x = env;