chiark / gitweb /
util: unify SO_PEERCRED/SO_PEERSEC invocations
[elogind.git] / src / shared / env-util.c
index d3d4c59ab9755abb078315c3a85cf8b0874fdbaf..7976881ef697acd0217314412cf0a344c8a75d76 100644 (file)
 #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;
 }