X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Fenv-util.c;h=7976881ef697acd0217314412cf0a344c8a75d76;hp=d3d4c59ab9755abb078315c3a85cf8b0874fdbaf;hb=eff05270986a13e7de93ae16311f654d3f7c166f;hpb=ebc05a09ad6d1672cf4f426ee4252cf495daa139 diff --git a/src/shared/env-util.c b/src/shared/env-util.c index d3d4c59ab..7976881ef 100644 --- a/src/shared/env-util.c +++ b/src/shared/env-util.c @@ -27,11 +27,10 @@ #include "utf8.h" #include "util.h" #include "env-util.h" +#include "def.h" #define VALID_CHARS_ENV_NAME \ - "0123456789" \ - "abcdefghijklmnopqrstuvwxyz" \ - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ + DIGITS LETTERS \ "_" #ifndef ARG_MAX @@ -227,7 +226,7 @@ fail: return NULL; } -static bool env_match(const char *t, const char *pattern) { +_pure_ static bool env_match(const char *t, const char *pattern) { assert(t); assert(pattern); @@ -406,7 +405,9 @@ char **strv_env_clean_log(char **e, const char *message) { e[k++] = *p; } - e[k] = NULL; + if (e) + e[k] = NULL; + return e; }