Fix incorrect close() call in dsm_impl_mmap().
authorTom Lane
Tue, 10 Apr 2018 22:34:40 +0000 (18:34 -0400)
committerTom Lane
Tue, 10 Apr 2018 22:34:40 +0000 (18:34 -0400)
One improbable error-exit path in this function used close() where
it should have used CloseTransientFile().  This is unlikely to be
hit in the field, and I think the consequences wouldn't be awful
(just an elog(LOG) bleat later).  But a bug is a bug, so back-patch
to 9.4 where this code came in.

Pan Bian

Discussion: https://postgr.es/m/152056616579.4966.583293218357089052@wrigleys.postgresql.org

src/backend/storage/ipc/dsm_impl.c

index 9ed05e283304374a7b34b884fe6dd47d27cfd6c3..d26301a82419a48af76623ab628f1bc10d3305f3 100644 (file)
@@ -923,7 +923,7 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size,
 
        /* Back out what's already been done. */
        save_errno = errno;
-       close(fd);
+       CloseTransientFile(fd);
        if (op == DSM_OP_CREATE)
            unlink(name);
        errno = save_errno;