diff options
Diffstat (limited to '')
-rw-r--r-- | src/sat.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -70,6 +70,9 @@ main(int argc, char *argv[], char *envp[]) struct timespec ts; clockid_t clk; char *msg = NULL; + char *w; + char *r; + int removed_empty = 0; size_t n; if ((argc < 3) || (argv[1][0] == '-')) { @@ -104,6 +107,18 @@ main(int argc, char *argv[], char *envp[]) argc -= 2; argv += 2; + /* Remove empty environment entries */ + for (w = r = envp; *r; *r++) { + if (**r) { + *w++ = *r; + } else if (removed_empty == 0) { + fprintf(stderr, + "%s: warning: removed empty " + "environment entry.\n", argv0); + removed_empty = 0; + } + } + /* Construct message to send to the daemon. */ n = measure_array(argv) + measure_array(envp); if (!(msg = malloc(n + sizeof(clk) + sizeof(ts)))) |