freebsd-skq/contrib
rdivacky 4117cffd4e Fix tcsh losing history when tcsh terminates because the pty beneath it
is closed.

Diagnosed by Ted Anderson:

New signal queuing logic was introduced in 6.15 and allows the signal handlers
to be run explicitly by calling handle_pending_signals, instead of
immediately when the signal is delivered.  This function is called at
various places, typically when receiving a EINTR from a slow system call
such as read or write.  In the pty exit case, it was called from xwrite,
called from flush, while printing the "exit" message after receiving EOF
when reading from the pty (note that the read did not return EINTR but
zero bytes, indicating EOF).  The SIGHUP handler, phup(), called
rechist, which opened the history file and began writing the merged
history to it.  This process invoked flush recursively to actually write
the data.  In this case, however, the flush noticed it was being called
recursively and decided fail by calling stderror.

My conclusion was that the signal was being handled at a bad time.  But
whether to fix flush not to care about the recursive call, or to handle
the signal some other time and when to handle it, was unclear to me.
However, by adding an extra call to handle_pending_signals, just after
process() returns to main(), I was able to avoid the truncated history
after network outages and similar failures.  I verified this fix in
version 6.17.

Approved by:	ed (mentor)
MFC after:	1 week
2009-10-06 20:19:16 +00:00
..
amd Remove build timestamps from the following files: 2009-07-11 22:30:37 +00:00
bc - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
bind9 Update to version 9.6.1-P1 which addresses a remote DoS vulnerability: 2009-07-29 00:15:39 +00:00
binutils Push mips support into the tree. 2008-12-11 08:22:20 +00:00
bsnmp Add an extra (void *) cast. The struct if_msghdr has an 8 byte 2009-02-18 19:59:27 +00:00
bzip2 Update and remove CVS-specific items 2009-08-13 06:07:38 +00:00
com_err - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
cpio Merge gnu cpio 2.6 -> 2.8 changes. Unfortunately, we have massive 2008-07-10 02:08:00 +00:00
csup - Remove semicolon that should not have been there. 2009-06-12 16:37:53 +00:00
cvs - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
diff - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
ee 1) Remove single occurance of HAS_CTYPE ifdef, ctype functions 2009-09-04 07:42:13 +00:00
expat - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
file Merge vendor/file/dist@192348, bringing FILE 5.03 to 8-CURRENT. 2009-05-18 22:34:33 +00:00
gcc Output DWARF debug information for global 'using' declarations, instead 2009-07-22 01:07:11 +00:00
gcclibs - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
gdb gdb: make 'thread apply all bt' always work on all threads 2009-06-12 14:27:50 +00:00
gdtoa Import a vendor fix for a list overrun. 2009-09-07 09:30:37 +00:00
gnu-sort - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
gperf - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
groff When man pages are formatted in UTF-8, .Fl is encoded as U+2212 "MINUS 2009-05-21 17:56:00 +00:00
ipfilter Fix a typo that causes the for loop to exit immediately. There's 2009-06-16 13:31:01 +00:00
less Update less to v436. This is considered as a bugfix release from vendor. 2009-07-29 09:20:32 +00:00
libbegemot - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
libf2c - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
libobjc - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
libpcap Revert previous commit that commented out some bpf functions. 2009-04-11 17:36:11 +00:00
libreadline - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
libstdc++ - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
lukemftp - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
lukemftpd Prevent cross-site forgery attacks on lukemftpd(8) due to splitting 2009-01-07 20:17:55 +00:00
ncurses - Update instructions for Subversion import 2008-11-15 09:30:09 +00:00
netcat Update and remove CVS-specific items 2009-08-13 06:07:38 +00:00
ngatm - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
ntp Remove build timestamps from the following files: 2009-07-11 22:30:37 +00:00
nvi - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
one-true-awk - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
openbsm Import OpenBSM 1.1p2 from vendor branch to 8-CURRENT. This patch release 2009-08-02 10:27:54 +00:00
openpam Update and remove CVS-specific items 2009-08-13 06:07:38 +00:00
opie - Remove non-existing reference 2009-01-30 15:43:55 +00:00
pam_modules/pam_passwdqc - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
pf - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
pnpinfo - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
sendmail Remove build timestamps from the following files: 2009-07-11 22:30:37 +00:00
smbfs Document the "-U" option. While it is not part of the 2009-01-22 08:29:39 +00:00
tcp_wrappers - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
tcpdump correct IEEE80211_RADIOTAP_XCHANNEL to match system 2009-07-15 13:50:06 +00:00
tcsh Fix tcsh losing history when tcsh terminates because the pty beneath it 2009-10-06 20:19:16 +00:00
telnet Rename all symbols in libmp(3) to mp_*, just like Solaris. 2009-02-26 21:43:15 +00:00
texinfo - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +00:00
top Explicitly line up the CPU state labels with the calculated starting column 2009-08-19 15:17:13 +00:00
traceroute - Add AS lookup functionality to traceroute6(8) as well. 2009-08-23 17:00:16 +00:00
wpa Add some notes and clarify a few sections: 2009-03-16 23:56:28 +00:00