[PATCH] Cygwin: Fix profiler error() definition and usage

Mark Geisert mark@maxrnd.com
Tue Nov 14 08:57:30 GMT 2023


Hi Corinna,

On Mon, 13 Nov 2023, Corinna Vinschen wrote:
> On Nov 13 01:46, Mark Geisert wrote:
>> Minor updates to profiler and gmondump, which share some code:
>> - fix operation of error() so it actually works as intended
>> - resize 4K-size auto buffer reservations to BUFSIZ (==1K)
>> - remove trailing '\n' from 2nd arg on error() calls everywhere
>> - provide consistent annotation of Windows error number displays
>>
>> Fixes: 9887fb27f6126 ("Cygwin: New tool: profiler")
>> Fixes: 087a3d76d7335 ("Cygwin: New tool: gmondump")
>> Signed-off-by: Mark Geisert <mark@maxrnd.com>
>
> Looks good basically, but I noticed some minor problem already
> in the former version of this code:
>
>> @@ -650,7 +652,7 @@ ctrl_c (DWORD)
>>    static int tic = 1;
>>
>>    if ((tic ^= 1) && !GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0))
>> -    error (0, "couldn't send CTRL-C to child, win32 error %d\n",
>> +    error (0, "couldn't send CTRL-C to child, Windows error %d",
>>             GetLastError ());
>>    return TRUE;
>
> GetLastError returns a DWORD == unsigned int. %u would be the
> right format specifier.  Care to fix that, too?

Thanks for catching this.  Patch v2 is incoming, and it includes a
relnote for 3.4.10.
Cheers & Regards,

..mark


More information about the Cygwin-patches mailing list