chiark / gitweb /
import-raw: when downloading raw images, generate sparse files if we can
[elogind.git] / src / shared / env-util.c
index b2e45531ab7ec0131e102075bc9b09397dfe0fb1..038246d21b7cd134fa34997be73d036d9ac036b2 100644 (file)
@@ -78,7 +78,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 +414,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_with_callback(char **e, void (*invalid_callback)(const char *p, void *userdata), void *userdata) {
         char **p, **q;
         int k = 0;
 
@@ -421,8 +423,8 @@ char **strv_env_clean_log(char **e, const char *message) {
                 bool duplicate = false;
 
                 if (!env_assignment_is_valid(*p)) {
-                        if (message)
-                                log_error("Ignoring invalid environment '%s': %s", *p, message);
+                        if (invalid_callback)
+                                invalid_callback(*p, userdata);
                         free(*p);
                         continue;
                 }
@@ -447,7 +449,3 @@ char **strv_env_clean_log(char **e, const char *message) {
 
         return e;
 }
-
-char **strv_env_clean(char **e) {
-        return strv_env_clean_log(e, NULL);
-}