We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4548 - Fix DirectInput error codes being silently discarded.
Summary: Fix DirectInput error codes being silently discarded.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.1
Hardware: x86 Windows 10
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-12 22:14 UTC by Jimb Esser
Modified: 2019-03-17 01:11 UTC (History)
0 users

See Also:


Attachments
Patch (1.29 KB, application/mbox)
2019-03-12 22:14 UTC, Jimb Esser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jimb Esser 2019-03-12 22:14:05 UTC
Created attachment 3696 [details]
Patch

SDL_dinputjoystick.c:SetDIerror includes the line:
  SDL_SetError("%s() DirectX error 0x%8.8lx", function, code);

SDL_SetError() does not handle %lx

Due to this, SDL_GetErrorMsg() returns a string like "... DirectX error 0x", silently discarding the error code, making troubleshooting difficult.

Fix here: https://github.com/Jimbly/SDL/commit/76fe4910590a2fe1d3ea4d78bb090c785b0bc32c
Patch attached.

The fix trivially adds support for %lx to SDL_SetError and SDL_GetErrorMsg.  Changing the SDL_SetError call to "%8.8x" would also reasonably fix this.
Comment 1 Sam Lantinga 2019-03-17 01:11:32 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/8a70b87401c3