diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c index 44962af32cd..340048a0d1e 100644 --- a/src/backend/storage/ipc/dsm_impl.c +++ b/src/backend/storage/ipc/dsm_impl.c @@ -49,6 +49,7 @@ #include "postgres.h" #include +#include #include #ifndef WIN32 #include @@ -62,7 +63,7 @@ #endif #include "common/file_perm.h" -#include "libpq/pqsignal.h" /* for PG_SETMASK macro */ +#include "libpq/pqsignal.h" #include "miscadmin.h" #include "pgstat.h" #include "portability/mem.h" @@ -355,6 +356,7 @@ dsm_impl_posix_resize(int fd, off_t size) { int rc; int save_errno; + sigset_t save_sigmask; /* * Block all blockable signals, except SIGQUIT. posix_fallocate() can run @@ -363,7 +365,7 @@ dsm_impl_posix_resize(int fd, off_t size) * conflicts), the retry loop might never succeed. */ if (IsUnderPostmaster) - PG_SETMASK(&BlockSig); + sigprocmask(SIG_SETMASK, &BlockSig, &save_sigmask); /* Truncate (or extend) the file to the requested size. */ do @@ -406,7 +408,7 @@ dsm_impl_posix_resize(int fd, off_t size) if (IsUnderPostmaster) { save_errno = errno; - PG_SETMASK(&UnBlockSig); + sigprocmask(SIG_SETMASK, &save_sigmask, NULL); errno = save_errno; }