[systemd-devel] [PATCH 1/2] EnvironmentFile: don't drop backslashes inside single quotes
--- 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 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] EnvironmentFile: don't drop backslashes inside single quotes
On Thu, Apr 10, 2014 at 03:17:20PM +0200, Lukas Nykryn wrote: > --- > 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; Can you please add a unit test for this? Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] EnvironmentFile: don't drop backslashes inside single quotes
Čt 10. duben 2014, 15:52:56 CEST, Zbigniew Jędrzejewski-Szmek napsal: On Thu, Apr 10, 2014 at 03:17:20PM +0200, Lukas Nykryn wrote: --- 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; Can you please add a unit test for this? Zbyszek Hmm, actually this patch breaks some current cases. Maybe there should be a different approach. Lukas ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel