diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc --- a/llvm/lib/Support/Unix/Process.inc +++ b/llvm/lib/Support/Unix/Process.inc @@ -236,11 +236,11 @@ std::error_code Process::SafelyCloseFileDescriptor(int FD) { // Create a signal set filled with *all* signals. - sigset_t FullSet; - if (sigfillset(&FullSet) < 0) + sigset_t FullSet, SavedSet; + if (sigfillset(&FullSet) < 0 || sigfillset(&SavedSet) < 0) return std::error_code(errno, std::generic_category()); + // Atomically swap our current signal mask with a full mask. - sigset_t SavedSet; #if LLVM_ENABLE_THREADS if (int EC = pthread_sigmask(SIG_SETMASK, &FullSet, &SavedSet)) return std::error_code(EC, std::generic_category());