chiark / gitweb /
env-util,fileio: immediately replace variables in load_env_file_push()
[elogind.git] / src / basic / fileio.c
index 411c8601b95d36a7f4f424357f8a816f75fd752b..5e7b63dbff1dc120a3cb4a7de62b889e26e8334c 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "alloc-util.h"
 #include "ctype.h"
 
 #include "alloc-util.h"
 #include "ctype.h"
+#include "env-util.h"
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
 #include "escape.h"
 #include "fd-util.h"
 #include "fileio.h"
@@ -678,13 +679,15 @@ static int load_env_file_push(
         if (r < 0)
                 return r;
 
         if (r < 0)
                 return r;
 
-        p = strjoin(key, "=", strempty(value));
+        p = strjoin(key, "=", value);
         if (!p)
                 return -ENOMEM;
 
         if (!p)
                 return -ENOMEM;
 
-        r = strv_consume(m, p);
-        if (r < 0)
+        r = strv_env_replace(m, p);
+        if (r < 0) {
+                free(p);
                 return r;
                 return r;
+        }
 
         if (n_pushed)
                 (*n_pushed)++;
 
         if (n_pushed)
                 (*n_pushed)++;