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

Commit359d601

Browse files
committed
Fix symlink() errno on Windows.
Ancient bug noticed while working on a test suite for these functions.https://postgr.es/m/CA%2BhUKG%2BajSQ_8eu2AogTncOnZ5me2D-Cn66iN_-wZnRjLN%2Bicg%40mail.gmail.com
1 parentf186c7c commit359d601

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

‎src/port/dirmod.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ pgsymlink(const char *oldpath, const char *newpath)
197197
FILE_FLAG_OPEN_REPARSE_POINT |FILE_FLAG_BACKUP_SEMANTICS,0);
198198

199199
if (dirhandle==INVALID_HANDLE_VALUE)
200+
{
201+
_dosmaperr(GetLastError());
200202
return-1;
203+
}
201204

202205
/* make sure we have an unparsed native win32 path */
203206
if (memcmp("\\??\\",oldpath,4)!=0)
@@ -230,8 +233,11 @@ pgsymlink(const char *oldpath, const char *newpath)
230233
0,0,&len,0))
231234
{
232235
LPSTRmsg;
236+
intsave_errno;
237+
238+
_dosmaperr(GetLastError());
239+
save_errno=errno;
233240

234-
errno=0;
235241
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
236242
FORMAT_MESSAGE_IGNORE_INSERTS |
237243
FORMAT_MESSAGE_FROM_SYSTEM,
@@ -251,6 +257,9 @@ pgsymlink(const char *oldpath, const char *newpath)
251257

252258
CloseHandle(dirhandle);
253259
RemoveDirectory(newpath);
260+
261+
errno=save_errno;
262+
254263
return-1;
255264
}
256265

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp