[all-commits] [llvm/llvm-project] e05baf: [InitLLVM] Ensure SIGPIPE handler installed before...

Vedant Kumar via All-commits all-commits at lists.llvm.org
Fri Jan 8 15:13:25 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e05baf40de8a3bbfcf4a765761b1147e94b7309c
      https://github.com/llvm/llvm-project/commit/e05baf40de8a3bbfcf4a765761b1147e94b7309c
  Author: Vedant Kumar <vsk at apple.com>
  Date:   2021-01-08 (Fri, 08 Jan 2021)

  Changed paths:
    A clang/test/Driver/sigpipe-handling.c
    M llvm/include/llvm/Support/InitLLVM.h
    M llvm/lib/Support/InitLLVM.cpp

  Log Message:
  -----------
  [InitLLVM] Ensure SIGPIPE handler installed before sigaction()

The pipe signal handler must be installed before any other handlers are
registered. This is because the Unix RegisterHandlers function does not
perform a sigaction() for SIGPIPE unless a one-shot handler is present,
to allow long-lived processes (like lldb) to fully opt-out of llvm's
SIGPIPE handling and ignore the signal safely.

Fixes a bug introduced in D70277.

Tested by running Nick's test case:

% xcrun ./bin/clang -E -fno-integrated-cc1 x.c | tee foo.txt | head

I verified that child cc1 process exits with IO_ERR, and that the parent
recognizes the error code, exiting cleanly.

Differential Revision: https://reviews.llvm.org/D94324




More information about the All-commits mailing list