• Tom Lane's avatar
    Leave SIGTTIN/SIGTTOU signal handling alone in postmaster child processes. · 125f551c
    Tom Lane authored
    For reasons lost in the mists of time, most postmaster child processes
    reset SIGTTIN/SIGTTOU signal handling to SIG_DFL, with the major exception
    that backend sessions do not.  It seems like a pretty bad idea for any
    postmaster children to do that: if stderr is connected to the terminal,
    and the user has put the postmaster in background, any log output would
    result in the child process freezing up.  Hence, switch them all to
    doing what backends do, ie, nothing.  This allows them to inherit the
    postmaster's SIG_IGN setting.  On the other hand, manually-launched
    processes such as standalone backends will have default processing,
    which seems fine.
    
    In passing, also remove useless resets of SIGCONT and SIGWINCH signal
    processing.  Perhaps the postmaster once changed those to something
    besides SIG_DFL, but it doesn't now, so these are just wasted (and
    confusing) syscalls.
    
    Basically, this propagates the changes made in commit 8e2998d8 from
    backends to other postmaster children.  Probably the only reason these
    calls now exist elsewhere is that I missed changing pgstat.c along with
    postgres.c at the time.
    
    Given the lack of field complaints that can be traced to this, I don't
    presently feel a need to back-patch.
    
    Discussion: https://postgr.es/m/5627.1542477392@sss.pgh.pa.us
    125f551c
bgwriter.c 13.4 KB