[pulseaudio-discuss] [PATCH v2 04/12] daemon: No need to check optarg, -p requires argument

Arun Raghavan arun at accosted.net
Tue Sep 15 23:51:00 PDT 2015


On 16 September 2015 at 12:11, Tanu Kaskinen <tanuk at iki.fi> wrote:
> On Wed, 2015-09-16 at 00:01 +0200, Peter Meerwald wrote:
>> From: Peter Meerwald <p.meerwald at bct-electronic.com>
>>
>> CID 1323589
>>
>> getopt() makes sure that we have an argument for -p
>> remove the broken check for optarg being set
>> ---
>>  src/daemon/cmdline.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c
>> index a2fb6d5..68a02e3 100644
>> --- a/src/daemon/cmdline.c
>> +++ b/src/daemon/cmdline.c
>> @@ -312,7 +312,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int
>> argc, char *const argv [], int *d
>>              case 'p':
>>              case ARG_DL_SEARCH_PATH:
>>                  pa_xfree(conf->dl_search_path);
>> -                conf->dl_search_path = *optarg ? pa_xstrdup(optarg)
>> : NULL;
>> +                conf->dl_search_path = pa_xstrdup(optarg);
>
> What was wrong with the check? Note that *optarg checks whether the
> argument is an empty string, not whether optarg is NULL. This changes
> the behaviour, and the commit message doesn't really explain what was
> wrong with the old behaviour.

Erf, that'll teach me to be lax about my own discipline during the freeze.

I'm not sure what the right thing to do here is. Having a pulseaudio
-p "" arguably isn't an error, so this patch might still be okay.

-- Arun


More information about the pulseaudio-discuss mailing list