Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf145454

Browse files
committed
Ensure _dosmaperr() actually sets errno correctly.
If logging is enabled, either ereport() or fprintf() might stomp on errnointernally, causing this function to return the wrong result. That mightonly end in a misleading error report, but in any code that's examiningerrno to decide what to do next, the consequences could be far graver.This has been broken since the very first version of this file in 2006... it's a bit astonishing that we didn't identify this long ago.Reported by Amit Kapila, though this isn't his proposed fix.
1 parentb7212c9 commitf145454

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎src/port/win32error.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ _dosmaperr(unsigned long e)
179179
{
180180
if (doserrors[i].winerr==e)
181181
{
182-
errno=doserrors[i].doserr;
182+
intdoserr=doserrors[i].doserr;
183+
183184
#ifndefFRONTEND
184185
ereport(DEBUG5,
185186
(errmsg_internal("mapped win32 error code %lu to %d",
186-
e,errno)));
187+
e,doserr)));
187188
#elifFRONTEND_DEBUG
188-
fprintf(stderr,_("mapped win32 error code %lu to %d"),e,errno);
189+
fprintf(stderr,_("mapped win32 error code %lu to %d"),e,doserr);
189190
#endif
191+
errno=doserr;
190192
return;
191193
}
192194
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp