[systemd-devel] [PATCH 1/2] EnvironmentFile: don't drop backslashes inside single quotes
Lukáš Nykrýn
lnykryn at redhat.com
Thu Apr 10 07:14:41 PDT 2014
Č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
More information about the systemd-devel
mailing list