From: Johannes Sixt Date: Mon, 21 Sep 2026 04:06:52 GMT Subject: Re: [PATCH] compat/winansi: fix die_lasterr() argument formatting Message-ID: <9c1cde3d-92c4-4684-834e-bae97fd33f5f@kdbg.org> In-Reply-To: Am 21.09.26 um 05:00 schrieb Yongqiang Tian: > 3. Remove die_lasterr() and report GetLastError() directly at those > call sites. This avoids the va_list forwarding, allocation, and > errno conversion altogether. > > The third direction now seems the simplest to me. It also follows > existing Windows-specific code in Git that reports GetLastError() > directly, for example: > > https://github.com/git/git/blob/9a0c4701dcd5725c4184599322b52933ff5005ca/compat/win32/syslog.c#L10-L13 > > and: > > https://github.com/git/git/blob/9a0c4701dcd5725c4184599322b52933ff5005ca/compat/fsmonitor/fsm-listen-win32.c#L106-L109 Sounds reasonable to me. > - die_lasterr("DuplicateHandle(%li) failed", > - (long) (intptr_t) hnd); > + die("DuplicateHandle(%p) failed: Windows error %lu", > + (void *)hnd, GetLastError()); But please leave the conversion to %p for another time. Concerning the text "Windows error", please follow existing practice. -- Hannes