summaryrefslogtreecommitdiff
path: root/src/shared/env-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/env-util.c')
-rw-r--r--src/shared/env-util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/shared/env-util.c b/src/shared/env-util.c
index 7a213a77c0..9a833d22e4 100644
--- a/src/shared/env-util.c
+++ b/src/shared/env-util.c
@@ -135,6 +135,21 @@ bool strv_env_is_valid(char **e) {
return true;
}
+bool strv_env_name_or_assignment_is_valid(char **l) {
+ char **p, **q;
+
+ STRV_FOREACH(p, l) {
+ if (!env_assignment_is_valid(*p) && !env_name_is_valid(*p))
+ return false;
+
+ STRV_FOREACH(q, p + 1)
+ if (streq(*p, *q))
+ return false;
+ }
+
+ return true;
+}
+
static int env_append(char **r, char ***k, char **a) {
assert(r);
assert(k);