aboutsummaryrefslogtreecommitdiffstats
path: root/src/sat.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/sat.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sat.c b/src/sat.c
index f84d44b..84140a4 100644
--- a/src/sat.c
+++ b/src/sat.c
@@ -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))))