[PATCH] Cygwin: Fix profiler error() definition and usage
Corinna Vinschen
corinna-cygwin@cygwin.com
Mon Nov 13 17:04:33 GMT 2023
Hi Mark,
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,
Corinna
More information about the Cygwin-patches
mailing list