[systemd-devel] [PATCH 1/2] EnvironmentFile: don't drop backslashes inside single quotes

Lukas Nykryn lnykryn at redhat.com
Thu Apr 10 06:17:20 PDT 2014


---
 src/shared/fileio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/shared/fileio.c b/src/shared/fileio.c
index f101269..0eb131d 100644
--- a/src/shared/fileio.c
+++ b/src/shared/fileio.c
@@ -446,11 +446,12 @@ static int parse_env_file_internal(
                         state = SINGLE_QUOTE_VALUE;
 
                         if (!strchr(newline, c)) {
-                                if (!greedy_realloc((void**) &value, &value_alloc, n_value+2)) {
+                                if (!greedy_realloc((void**) &value, &value_alloc, n_value+3)) {
                                         r = -ENOMEM;
                                         goto fail;
                                 }
 
+                                value[n_value++] = '\\';
                                 value[n_value++] = c;
                         }
                         break;
-- 
1.9.0



More information about the systemd-devel mailing list