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

Appearance settings

Commit d726e44

Browse filesBrowse files
committed
Don't Insert() a VFD entry until it's fully built.
Otherwise, if FDDEBUG is enabled, the debugging output fails because it tries to read the fileName, which isn't set up yet (and should in fact always be NULL). AFAICT, this has been wrong since Berkeley. Before 96bf88d, it would accidentally fail to crash on platforms where snprintf() is forgiving about being passed a NULL pointer for %s; but the file name intended to be included in the debug output wouldn't ever have shown up. Report and fix by Greg Nancarrow. Although this is only visibly broken in custom-made builds, it still seems worth back-patching to all supported branches, as the FDDEBUG code is pretty useless as it stands. Discussion: https://postgr.es/m/CAJcOf-cUDgm9qYtC_B6XrC6MktMPNRby2p61EtSGZKnfotMArw@mail.gmail.com
1 parent de56e96 commit d726e44
Copy full SHA for d726e44

File tree

Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed
Filter options
  • src/backend/storage/file
Expand file treeCollapse file tree

1 file changed

+2
-2
lines changed

‎src/backend/storage/file/fd.c

Copy file name to clipboardExpand all lines: src/backend/storage/file/fd.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,8 +1323,6 @@ PathNameOpenFile(FileName fileName, int fileFlags, int fileMode)
13231323
DO_DB(elog(LOG, "PathNameOpenFile: success %d",
13241324
vfdP->fd));
13251325

1326-
Insert(file);
1327-
13281326
vfdP->fileName = fnamecopy;
13291327
/* Saved flags are adjusted to be OK for re-opening file */
13301328
vfdP->fileFlags = fileFlags & ~(O_CREAT | O_TRUNC | O_EXCL);
@@ -1334,6 +1332,8 @@ PathNameOpenFile(FileName fileName, int fileFlags, int fileMode)
13341332
vfdP->fdstate = 0x0;
13351333
vfdP->resowner = NULL;
13361334

1335+
Insert(file);
1336+
13371337
return file;
13381338
}
13391339

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.