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

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Apr 10 06:52:56 PDT 2014


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


More information about the systemd-devel mailing list