X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fenv-util.c;h=d90b878d1920e56b7a455443be3cc3448d4d17c5;hb=f9aa5413807e163df49171793eb93a230cd7b955;hp=b2e45531ab7ec0131e102075bc9b09397dfe0fb1;hpb=43d03a83766a0d63f535e2afa6aeb6e6acbe83b2;p=elogind.git diff --git a/src/shared/env-util.c b/src/shared/env-util.c index b2e45531a..d90b878d1 100644 --- a/src/shared/env-util.c +++ b/src/shared/env-util.c @@ -28,6 +28,7 @@ #include "util.h" #include "env-util.h" #include "def.h" +#include "unit.h" #define VALID_CHARS_ENV_NAME \ DIGITS LETTERS \ @@ -78,7 +79,9 @@ bool env_value_is_valid(const char *e) { if (!utf8_is_valid(e)) return false; - if (string_has_cc(e)) + /* bash allows tabs in environment variables, and so should + * we */ + if (string_has_cc(e, "\t")) return false; /* POSIX says the overall size of the environment block cannot @@ -412,7 +415,7 @@ char *strv_env_get(char **l, const char *name) { return strv_env_get_n(l, name, strlen(name)); } -char **strv_env_clean_log(char **e, const char *message) { +char **strv_env_clean_log(char **e, const char *unit_id, const char *message) { char **p, **q; int k = 0; @@ -422,7 +425,7 @@ char **strv_env_clean_log(char **e, const char *message) { if (!env_assignment_is_valid(*p)) { if (message) - log_error("Ignoring invalid environment '%s': %s", *p, message); + log_error_unit(unit_id, "Ignoring invalid environment '%s': %s", *p, message); free(*p); continue; } @@ -449,5 +452,5 @@ char **strv_env_clean_log(char **e, const char *message) { } char **strv_env_clean(char **e) { - return strv_env_clean_log(e, NULL); + return strv_env_clean_log(e, NULL, NULL); }