summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
78bc7d9)
When setting an environment variable as a space-separated list, and
the list is empty, we must not delete the '=' before the value.
In practice putenv() is likely to discard the invalid string, leaving
the variable unset, but this is not guaranteed.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
buf_len += strlen(&buf[buf_len]);
buf[buf_len++] = ' ';
}
buf_len += strlen(&buf[buf_len]);
buf[buf_len++] = ' ';
}
- buf[buf_len - 1] = '\0';
+ if (buf[buf_len - 1] == ' ')
+ buf_len--;
+ buf[buf_len] = '\0';
buf_len += strlen(&buf[buf_len]);
buf[buf_len++] = ' ';
}
buf_len += strlen(&buf[buf_len]);
buf[buf_len++] = ' ';
}
- buf[buf_len - 1] = '\0';
+ if (buf[buf_len - 1] == ' ')
+ buf_len--;
+ buf[buf_len] = '\0';
- buf[buf_len - 1] = '\0';
+ if (buf[buf_len - 1] == ' ')
+ buf_len--;
+ buf[buf_len] = '\0';
+ if (c[-1] == ' ')
+ c--;
+ *c = '\0';