[PATCH xkbcomp 2/2] Parse -w1 flag correctly (#66344)

Matt Dew marcoz at osource.org
Wed Jul 17 21:37:03 PDT 2013


On 07/16/2013 03:31 PM, Peter Hutterer wrote:
> On Tue, Jul 16, 2013 at 11:56:22AM -0600, Matt Dew wrote:
>> On 07/13/2013 12:15 AM, Alan Coopersmith wrote:
>>> On 07/10/13 08:58 PM, Peter Hutterer wrote:
>>>> if the flag is "-w", then argv[i][1] is 'w' and unlikely to be a digit.
>>>> Access [2] instead, which is either \0 or an actual digit.
>>>>
>>>> X.Org Bug 66344 <http://bugs.freedesktop.org/show_bug.cgi?id=66344>
>>>>
>>>> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
>>>> ---
>>>>    xkbcomp.c | 4 ++--
>>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/xkbcomp.c b/xkbcomp.c
>>>> index 440d542..fb5dec2 100644
>>>> --- a/xkbcomp.c
>>>> +++ b/xkbcomp.c
>>>> @@ -579,8 +579,8 @@ parseArgs(int argc, char *argv[])
>>>>                if ((i >= (argc - 1)) || (!isdigit(argv[i + 1][0])))
>>>>                {
>>>>                    warningLevel = 0;
>>>> -                if (isdigit(argv[i][1]))
>>>> -                    if (sscanf(&argv[i][1], "%i", &itmp) == 1)
>>>> +                if (isdigit(argv[i][2]))
>>>> +                    if (sscanf(&argv[i][2], "%i", &itmp) == 1)
>>>>                            warningLevel = itmp;
>>>>                }
>>>>                else
>>>>
>>>
>>> Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
>>>
>>
>>
>> What if it's a space?  '-w 1'
>
> that's handled (see the bug, it's about -w1 not working, but -w 1 does). the
> code for that is just outside of the diff context, it's in the else branch
> above.
>

In that case, Reviewed-By:  Matt Dew <marcoz at osource.org>





More information about the xorg-devel mailing list