From: Andres Freund Date: Mon, 21 May 2018 22:43:30 +0000 (-0700) Subject: Make FileGetRawDesc() ensure there's an associated kernel FD. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=87a6fa9b8d478504b0a4323a3e104b353a239f1a;p=users%2Fandresfreund%2Fpostgres.git Make FileGetRawDesc() ensure there's an associated kernel FD. Author: Andres Freund Reviewed-By: Discussion: https://postgr.es/m/ Backpatch: --- diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 65e46483a4..8ae13a51ec 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -2232,6 +2232,10 @@ int FileGetRawDesc(File file) { Assert(FileIsValid(file)); + + if (FileAccess(file)) + return -1; + return VfdCache[file].fd; }