Make FileGetRawDesc() ensure there's an associated kernel FD.
authorAndres Freund <andres@anarazel.de>
Mon, 21 May 2018 22:43:30 +0000 (15:43 -0700)
committerAndres Freund <andres@anarazel.de>
Mon, 21 May 2018 22:43:30 +0000 (15:43 -0700)
Author: Andres Freund
Reviewed-By:
Discussion: https://postgr.es/m/
Backpatch:

src/backend/storage/file/fd.c

index 65e46483a44bce571c01b609f76a71e610b65294..8ae13a51ec1ae32e59f2d19d55f25f73727e8563 100644 (file)
@@ -2232,6 +2232,10 @@ int
 FileGetRawDesc(File file)
 {
    Assert(FileIsValid(file));
+
+   if (FileAccess(file))
+       return -1;
+
    return VfdCache[file].fd;
 }