freebsd-dev/contrib
Roman Divacky dd8eeffea9 MFC r197812:
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:	re (kib)
2009-10-12 15:46:17 +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 merge r196164: update & remove CVS-specific items. 2009-08-13 06:13:45 +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 - Import the HEAD csup code which is the basis for the cvsmode work. 2008-10-19 08:41:10 +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 char can be unsigned, like on ARM and PowerPC. Unbreak the 2009-05-28 04:25:38 +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 MFC r196916: 2009-09-10 11:27:07 +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 merge r196164: update & remove CVS-specific items. 2009-08-13 06:13:45 +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 merge r196164: update & remove CVS-specific items. 2009-08-13 06:13:45 +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 MFC r197812: 2009-10-12 15:46:17 +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 MFC 196382: 2009-08-19 17:45:58 +00:00
traceroute MFC r196475: 2009-09-13 11:34:33 +00:00
wpa Add some notes and clarify a few sections: 2009-03-16 23:56:28 +00:00