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

Commit250041a

Browse files
committed
Save errno across LWLockRelease() calls
Fixup for "Drop slot's LWLock before returning from SaveSlotToPath()"Reported-by: Michael Paquier <michael@paquier.xyz>
1 parent0912fb3 commit250041a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/backend/replication/slot.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,9 +1260,13 @@ SaveSlotToPath(ReplicationSlot *slot, const char *dir, int elevel)
12601260
/*
12611261
* If not an ERROR, then release the lock before returning. In case
12621262
* of an ERROR, the error recovery path automatically releases the
1263-
* lock, but no harm in explicitly releasing even in that case.
1263+
* lock, but no harm in explicitly releasing even in that case. Note
1264+
* that LWLockRelease() could affect errno.
12641265
*/
1266+
intsave_errno=errno;
1267+
12651268
LWLockRelease(&slot->io_in_progress_lock);
1269+
errno=save_errno;
12661270
ereport(elevel,
12671271
(errcode_for_file_access(),
12681272
errmsg("could not create file \"%s\": %m",
@@ -1329,7 +1333,10 @@ SaveSlotToPath(ReplicationSlot *slot, const char *dir, int elevel)
13291333
/* rename to permanent file, fsync file and directory */
13301334
if (rename(tmppath,path)!=0)
13311335
{
1336+
intsave_errno=errno;
1337+
13321338
LWLockRelease(&slot->io_in_progress_lock);
1339+
errno=save_errno;
13331340
ereport(elevel,
13341341
(errcode_for_file_access(),
13351342
errmsg("could not rename file \"%s\" to \"%s\": %m",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp