rsalz@uunet.uu.net (Rich Salz) (03/06/91)
Submitted-by: Syd Weinstein <syd@DSI.COM> Posting-number: Volume 24, Issue 26 Archive-name: elm2.3patches/part02 Subject: elm 2.3 Patch #2 Summary: This is an official patch for elm 2.3 system. Please apply it. Priority: MEDIUM More of the release cleanup, more to come still... Update install to update test prompts for alias current message From: Syd Some wait system calls return with -1 and errno=4 (interrupted system call) when the editor is invoked, suspended, and then resumed. Loop until wait returns pid, or returns -1 *if errno != EINTR*. If wait returns -1 and errno = EINTR, we wait again. Some flock()s refuse to exclusively lock a fd open for read-only access. From: pdc%lunch.wpd@sgi.com (Paul Close) Use a close-on-exec pipe to diagnose exec() failures. From: tct!chip@uunet.UU.NET (Chip Salzenberg) Allow use of submit with mmdf instead of sendmail stub From: martin <martin@hppcmart.grenoble.hp.com> Fix: From rn, say "| patch -p -N -d DIR", where DIR is your elm source directory. Outside of rn, say "cd DIR; patch -p -N <thisarticle". If you don't have the patch program, apply the following by hand, or get patch (version 2.0, latest patchlevel). After patching: sh Configure -d make make install If patch indicates that patchlevel is the wrong version, you may need to apply one or more previous patches, or the patch may already have been applied. See the patchlevel.h file to find out what has or has not been applied. In any event, don't continue with the patch. If you are missing previous patches they can be obtained from our: archive server. Syd Weinstein elm@DSI.COM The patches are available from the dsinc archive server Send the following message to archive-server@DSI.COM for a list of available patches: Subject: patch list send index elm Index: hdrs/patchlevel.h Prereq: 1 *** ../elm2.3/hdrs/patchlevel.h Tue Jun 5 22:02:31 1990 --- hdrs/patchlevel.h Sat Jun 9 21:18:04 1990 *************** *** 1 **** ! #define PATCHLEVEL 1 --- 1 ---- ! #define PATCHLEVEL 2 Index: Instruct *** ../elm2.3/Instruct Sat Apr 28 22:40:44 1990 --- Instruct Sat Jun 9 21:17:13 1990 *************** *** 1,7 **** Instructions ------------ ! Last Update: $Date: 90/04/28 22:40:43 $ This file contains instructions on how to create and install --- 1,7 ---- Instructions ------------ ! Last Update: $Date: 90/06/09 21:17:05 $ This file contains instructions on how to create and install *************** *** 72,80 **** $ elm -f test/test.mail should read in EIGHT messages from various people. While here, try to ! A)lias C)urrent message for each of the eight messages to confirm that ! the reply/address system is working okay. Now Q)uit without having ! marked anything for deletion...answer the questions accordingly. If you get this far you're in wonderful shape! In fact, you're done! --- 72,81 ---- $ elm -f test/test.mail should read in EIGHT messages from various people. While here, try to ! A)lias, A)lias current message for each of the eight messages to ! confirm that the reply/address system is working okay. Now Q)uit ! without having marked anything for deletion...answer the questions ! accordingly. If you get this far you're in wonderful shape! In fact, you're done! *************** *** 106,114 **** That's it! ---------- - - Author's address: taylor@hplabs.HP.COM - hplabs!taylor This document and the entire mail system is --- 107,112 ---- Index: Configure Prereq: 4.1.1.1 *** ../elm2.3/Configure Tue Jun 5 22:02:33 1990 --- Configure Sat Jun 9 23:25:30 1990 *************** *** 8,14 **** # and edit it to reflect your system. Some packages may include samples # of config.h for certain machines, so you might look for one of those.) # ! # $Header: /files/home/users/syd/elm.rel/RCS/Configure,v 4.1.1.1 90/05/31 20:46:41 syd Exp $ # # Yes, you may rip this off to use in other distribution packages. # (Note: this Configure script was generated automatically. Rather than --- 8,14 ---- # and edit it to reflect your system. Some packages may include samples # of config.h for certain machines, so you might look for one of those.) # ! # $Header: /files/home/users/syd/elm.rel/RCS/Configure,v 4.1.1.4 90/06/09 23:24:59 syd Exp $ # # Yes, you may rip this off to use in other distribution packages. # (Note: this Configure script was generated automatically. Rather than *************** *** 110,115 **** --- 110,116 ---- sendmail='' shar='' smail='' + submit='' tbl='' troff='' nroff='' *************** *** 257,263 **** attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__" d_newshome="/usr/NeWS" defvoidused=7 ! pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb /usr/convex" : check for out bin directory if test ! -d ../bin; then --- 258,264 ---- attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__" d_newshome="/usr/NeWS" defvoidused=7 ! pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb /usr/convex /usr/mmdf/bin" : check for out bin directory if test ! -d ../bin; then *************** *** 526,531 **** --- 527,533 ---- sendmail shar smail + submit tar tbl test *************** *** 2323,2332 **** fi fi : determine mail delivery agent for Elm to use case "$mailer" in '') ! if $test -f "$sendmail"; then dflt="$sendmail" elif $test -f "$rmail"; then dflt="$rmail" --- 2325,2360 ---- fi fi + case "$d_mmdf" in + "$define") dflt=y;; + "$undef") dflt=n;; + *) if $test -f "$submit"; then + dflt=y + fi + ;; + esac + $cat <<EOM + + Some systems run MMDF as their Mail Transport Agent. MMDF uses + a different way of delimiting messages in the mailbox files. + Usually this is a series of four Control A's. $package needs to know + if this system uses MMDF. + + EOM + rp="Does this system use MMDF as its MTA? [$dflt]" + $echo $n "$rp $c" + . myread + case "$ans" in + y*) d_mmdf="$define";; + *) d_mmdf="$undef";; + esac + : determine mail delivery agent for Elm to use case "$mailer" in '') ! if $test "$d_mmdf" = "$define" -a -f "$submit"; then ! dflt="$submit" ! elif $test -f "$sendmail"; then dflt="$sendmail" elif $test -f "$rmail"; then dflt="$rmail" *************** *** 2367,2372 **** --- 2395,2403 ---- if $test "$mailer" != "$sendmail"; then sendmail='' fi + if $test "$mailer" != "$submit"; then + submit='' + fi : check for internet mailer case "$d_internet" in *************** *** 2374,2379 **** --- 2405,2412 ---- "$undef") dflt=n;; *) if $test -f "$sendmail"; then dflt=y + elif $test -f "$submit"; then + dflt=y elif $test -f "$smail"; then dflt=y else *************** *** 2421,2447 **** set mkdir d_mkdir eval $inlibc - case "$d_mmdf" in - "$define") dflt=y;; - "$undef") dflt=n;; - *) dflt=n;; - esac - $cat <<EOM - - Some systems run MMDF as their Mail Transport Agent. MMDF uses - a different way of delimiting messages in the mailbox files. - Usually this is a series of four Control A's. $package needs to know - if this system uses MMDF. - - EOM - rp="Does this system use MMDF as its MTA? [$dflt]" - $echo $n "$rp $c" - . myread - case "$ans" in - y*) d_mmdf="$define";; - *) d_mmdf="$undef";; - esac - : ask about newmail running in the background automatically case "$d_newauto" in "$define") dflt=y;; --- 2454,2459 ---- *************** *** 2510,2515 **** --- 2522,2532 ---- d_noaddfrom="$define" d_nocheckvalid="$define" d_usedomain="$undef" + elif $test -f "$submit"; then + echo "You're running submit with MMDF. Setting noaddfrom, nocheckvalid, usedomain" + d_noaddfrom="$undef" + d_nocheckvalid="$define" + d_usedomain="$define" else case "$d_nocheckvalid" in "$define") dflt=n;; *************** *** 2519,2525 **** $cat << EOM ! Since you're not running sendmail, should I check local user entered addresses against the valid mailboxes on this system? EOM --- 2536,2542 ---- $cat << EOM ! Since you're not running sendmail or submit, should I check local user entered addresses against the valid mailboxes on this system? EOM *************** *** 3144,3149 **** --- 3161,3169 ---- elif $contains 'void.*signal' $$.tmp >/dev/null 2>&1 ; then echo "You have void (*signal())() instead of int." d_voidsig="$define" + elif $contains 'extern.*signal' $$.tmp >/dev/null 2>&1 ; then + echo "You have int (*signal())() instead of void." + d_voidsig="$undef" elif $test -n "$d_voidsig"; then echo $n "As you already told me, signal handlers return " if $test "$d_voidsig" = "$define"; then *************** *** 3153,3159 **** fi else echo "I can't determine whether signal handlers return void or int..." ! echo "I'm assuming they return void like ANSI and POSIX want" d_voidsig="$define" fi rm -f $$.tmp --- 3173,3181 ---- fi else echo "I can't determine whether signal handlers return void or int..." ! echo "I'm assuming they return void like ANSI and POSIX want." ! echo "If not, you will have to change d_voidsig from $define to $undef" ! echo "in config.sh at the edit question at the end of Configure" d_voidsig="$define" fi rm -f $$.tmp *************** *** 3788,3793 **** --- 3810,3816 ---- sendmail='$sendmail' shar='$shar' smail='$smail' + submit='$submit' tbl='$tbl' troff='$troff' nroff='$nroff' Index: Patchlist *** ../elm2.3/Patchlist Sat Apr 28 22:40:57 1990 --- Patchlist Sat Jun 9 23:00:32 1990 *************** *** 1,3 **** ! This file will contain the date and comment header from each ! official patch as issued. Since this is the full new release, ! there are currently no patches. --- 1,67 ---- ! Elm 2.3 Patch 2 - Release cleanup - Part II ! Sat Jun 9 22:59:02 EDT 1990 (Creation date, not posting date) ! Update install to update test prompts for alias current message ! From: Syd ! ! Some wait system calls return with -1 and errno=4 (interrupted system call) when the ! editor is invoked, suspended, and then resumed. Loop until wait returns pid, or ! returns -1 *if errno != EINTR*. If wait returns -1 and errno = EINTR, we wait again. ! Some flock()s refuse to exclusively lock a fd open for read-only access. ! From: pdc%lunch.wpd@sgi.com (Paul Close) ! ! Use a close-on-exec pipe to diagnose exec() failures. ! From: tct!chip@uunet.UU.NET (Chip Salzenberg) ! ! Allow use of submit with mmdf instead of sendmail stub ! From: martin <martin@hppcmart.grenoble.hp.com> ! ! Elm 2.3 Patch 1 - Release cleanup - Part I ! Tue Jun 5 22:25:25 EDT 1990 (Creation date, not posting date) ! Fixed Metaconfig prototype for voidsig, the test was backwards ! (had a -z where a -n should have been) ! From: Syd ! ! The open system call in actions.c for EMERGENCY_MAILBOX and EMER_MBOX ! were tested with the inequality >= 0 exactly backwards. ! If the user's system mail box (/usr/spool/mail/user_id) is ! removed the attempt of filter to flock it fails. If it does not exist then ! it should create it and then lock it. ! From: john@hopf.math.nwu.edu (John Franks) ! ! Allow nesting on () in comment in address ! From: Chip Rosenthal <chip@chinacat.Unicom.COM> ! ! Fix boundary condition in add_name_to_list() where it fails to ! print error message. ! From: Chip Rosenthal <chip@chinacat.Unicom.COM> ! ! Fixes the 'g' Group Reply command to send to the cc list also. ! A bad variable name caused it to be ignored. ! From: chip@chinacat.Unicom.COM (Chip Rosenthal) ! ! Fixes when ALLOW_SUBSHELL #define'd and you are in the ! Message Header Edit Screen and the mail you just composed ! is not a reply THEN the subshell command is executed. ! From: zvr@natasha.cs.wisc.EDU (Alexios Zavras) ! ! Fixes where src/curses.c attempts to set the screen size via the ioctl ! TIOCGWINSIZ if it exsists. It should only use the row or col size as ! returned from the ioctl if they are not 0. ! From: muller%sdcc10@ucsd.edu (Keith Muller) ! ! alias command in ELM2.3 fails because of the wrong sized aliases.hash ! newalias did not truncate existing file (aliases.hash) ! From: Toshinori Maeno <tmaeno@cc.titech.ac.jp> ! ! Fix htonl() double define problems ! From: Syd ! ! Fix aliases.hash.tmp being over 14 chars and causing rename problems ! on a 14 character limit system. ! From: Syd ! ! Fix now spurious error message for alias recursive expansion ! when alias lookup is on a string over 20 chars long. If that ! long, its just not an alias, so just return. ! From: Syd ! Index: doc/Ref.guide Prereq: 4.1 *** ../elm2.3/doc/Ref.guide Sat Apr 28 22:41:15 1990 --- doc/Ref.guide Sat Jun 9 22:49:53 1990 *************** *** 1,4 **** ! .\" @(#)$Id: Ref.guide,v 4.1 90/04/28 22:41:08 syd Exp $ .\" .\" Reference guide to the Elm mail system. .\" format with --- 1,4 ---- ! .\" @(#)$Id: Ref.guide,v 4.1.1.1 90/06/09 22:49:11 syd Exp $ .\" .\" Reference guide to the Elm mail system. .\" format with *************** *** 12,17 **** --- 12,21 ---- .\" (C) Copyright 1988, 1989, 1990 Usenet Community Trust .\" .\" $Log: Ref.guide,v $ + .\" Revision 4.1.1.1 90/06/09 22:49:11 syd + .\" Droped obsolete control Q command from list + .\" From: Joe Wasik + .\" .\" Revision 4.1 90/04/28 22:41:08 syd .\" checkin of Elm 2.3 as of Release PL0 .\" *************** *** 438,444 **** If on, this tells \f2elm\f1 that you have an HP terminal and enables the <NEXT>, <PREV>, <HOME> and <SHIFT-HOME> keys. (The default is OFF.) ! .lp menus* 1.0i If turned off, this will inhibit the Menu display on all of the screen displays within the \f2elm\f1 program. (Note that this is overridden by the similar `-m' command line option, --- 442,448 ---- If on, this tells \f2elm\f1 that you have an HP terminal and enables the <NEXT>, <PREV>, <HOME> and <SHIFT-HOME> keys. (The default is OFF.) ! .lp menu* 1.0i If turned off, this will inhibit the Menu display on all of the screen displays within the \f2elm\f1 program. (Note that this is overridden by the similar `-m' command line option, Index: doc/Users.guide Prereq: 4.1 *** ../elm2.3/doc/Users.guide Sat Apr 28 22:41:20 1990 --- doc/Users.guide Sat Jun 9 22:50:05 1990 *************** *** 1,4 **** ! .\" @(#)$Id: Users.guide,v 4.1 90/04/28 22:41:16 syd Exp $ .\" .\" Users guide to the ELM mail system. .\" format with: --- 1,4 ---- ! .\" @(#)$Id: Users.guide,v 4.1.1.1 90/06/09 22:49:54 syd Exp $ .\" .\" Users guide to the ELM mail system. .\" format with: *************** *** 12,17 **** --- 12,21 ---- .\" (C) Copyright 1988, 1989, 1990 Usenet Community Trust .\" .\" $Log: Users.guide,v $ + .\" Revision 4.1.1.1 90/06/09 22:49:54 syd + .\" Droped obsolete control Q command from list + .\" From: Joe Wasik + .\" .\" Revision 4.1 90/04/28 22:41:16 syd .\" checkin of Elm 2.3 as of Release PL0 .\" *************** *** 506,513 **** Quit \(em maybe prompting for messages to delete, store, or keep. .lp \h'18p'Q 90p Quick quit \(em like quit but without prompting. - .lp \h'18p'<control>-Q 90p - Exit immediately \(em don't record as read, don't save... .lp \h'18p'r 90p Reply to the author of current message. .lp \h'18p's 90p --- 510,515 ---- Index: hdrs/sysdefs.SH Prereq: 4.1 *** ../elm2.3/hdrs/sysdefs.SH Sat Apr 28 22:42:15 1990 --- hdrs/sysdefs.SH Sat Jun 9 22:28:43 1990 *************** *** 12,20 **** esac echo "Extracting hdrs/sysdefs.h (with variable substitutions)" sed <<!GROK!THIS! >sysdefs.h -e 's!^#undef!/\*#undef!' ! /* $Id: sysdefs.SH,v 4.1 90/04/28 22:42:14 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 12,20 ---- esac echo "Extracting hdrs/sysdefs.h (with variable substitutions)" sed <<!GROK!THIS! >sysdefs.h -e 's!^#undef!/\*#undef!' ! /* $Id: sysdefs.SH,v 4.1.1.1 90/06/09 22:28:42 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 26,31 **** --- 26,35 ---- * ******************************************************************************* * $Log: sysdefs.SH,v $ + * Revision 4.1.1.1 90/06/09 22:28:42 syd + * Allow use of submit with mmdf instead of sendmail stub + * From: martin <martin@hppcmart.grenoble.hp.com> + * * Revision 4.1 90/04/28 22:42:14 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 98,104 **** #define sendmail "$sendmail" #define smflags "-oi -oem" /* ignore dots and mail back errors */ ! #define smflagsv "-oi -oem -v" /* Verbose voyuer mode */ #define mailer "$mailer" #define mailx "$mailx" --- 102,110 ---- #define sendmail "$sendmail" #define smflags "-oi -oem" /* ignore dots and mail back errors */ ! #define smflagsv "-oi -oem -v" /* Verbose voyuer mode */ ! #define submitmail "$submit" ! #define submitflags "-mlrnxto,cc*" #define mailer "$mailer" #define mailx "$mailx" Index: src/editmsg.c Prereq: 4.1 *** ../elm2.3/src/editmsg.c Sat Apr 28 22:42:49 1990 --- src/editmsg.c Sat Jun 9 23:33:31 1990 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: editmsg.c,v 4.1 90/04/28 22:42:47 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: editmsg.c,v 4.1.1.1 90/06/09 23:33:06 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: editmsg.c,v $ + * Revision 4.1.1.1 90/06/09 23:33:06 syd + * Only say cannot invoke on -1 error which is cannot do exec in system call + * From: Syd + * * Revision 4.1 90/04/28 22:42:47 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 76,82 **** if (cursor_control) transmit_functions(OFF); /* function keys are local */ ! if ((stat = system_call(buffer, SH, TRUE, FALSE)) != 0) { dprint(1,(debugfile, "System call failed with stat %d (edit_the_message)\n", stat)); --- 80,86 ---- if (cursor_control) transmit_functions(OFF); /* function keys are local */ ! if ((stat = system_call(buffer, SH, TRUE, FALSE)) == -1) { dprint(1,(debugfile, "System call failed with stat %d (edit_the_message)\n", stat)); Index: src/leavembox.c Prereq: 4.1 *** ../elm2.3/src/leavembox.c Sat Apr 28 22:43:20 1990 --- src/leavembox.c Sat Jun 9 21:53:32 1990 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: leavembox.c,v 4.1 90/04/28 22:43:18 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: leavembox.c,v 4.1.1.1 90/06/09 21:33:23 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 14,19 **** --- 14,26 ---- * ******************************************************************************* * $Log: leavembox.c,v $ + * Revision 4.1.1.1 90/06/09 21:33:23 syd + * Some wait system calls return with -1 and errno=4 (interrupted system call) when the + * editor is invoked, suspended, and then resumed. Loop until wait returns pid, or + * returns -1 *if errno != EINTR*. If wait returns -1 and errno = EINTR, we wait again. + * Some flock()s refuse to exclusively lock a fd open for read-only access. + * From: pdc%lunch.wpd@sgi.com (Paul Close) + * * Revision 4.1 90/04/28 22:43:18 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 795,801 **** /* Now we also need to lock the file with flock(2) */ /* Open mail file separately for locking */ ! if((flock_fd = open(cur_folder, O_RDONLY)) < 0) { dprint(1, (debugfile, "Error encountered attempting to reopen %s for lock\n", cur_folder)); dprint(1, (debugfile, "** %s - %s **\n", error_name(errno), --- 802,808 ---- /* Now we also need to lock the file with flock(2) */ /* Open mail file separately for locking */ ! if((flock_fd = open(cur_folder, O_RDWR)) < 0) { dprint(1, (debugfile, "Error encountered attempting to reopen %s for lock\n", cur_folder)); dprint(1, (debugfile, "** %s - %s **\n", error_name(errno), Index: src/mailmsg2.c Prereq: 4.1 *** ../elm2.3/src/mailmsg2.c Sat Apr 28 22:43:30 1990 --- src/mailmsg2.c Sat Jun 9 23:20:28 1990 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 4.1 90/04/28 22:43:28 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 4.1.1.2 90/06/09 23:20:24 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.2 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 14,19 **** --- 14,26 ---- * ******************************************************************************* * $Log: mailmsg2.c,v $ + * Revision 4.1.1.2 90/06/09 23:20:24 syd + * fix typo + * + * Revision 4.1.1.1 90/06/09 22:28:39 syd + * Allow use of submit with mmdf instead of sendmail stub + * From: martin <martin@hppcmart.grenoble.hp.com> + * * Revision 4.1 90/04/28 22:43:28 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 339,347 **** ) #endif ! strcpy(mailerflags, (sendmail_verbose ? smflagsv : smflags)); else ! mailerflags[0] ='\0'; quote_args(very_long_buffer, strip_parens(strip_commas(expanded_to))); strcpy(expanded_to, very_long_buffer); --- 346,356 ---- ) #endif ! strcpy(mailerflags, (sendmail_verbose ? smflagsv : smflags)); ! else if (strcmp(submitmail, mailer) == 0) ! strcpy(mailerflags, submitflags); else ! mailerflags[0] ='\0'; quote_args(very_long_buffer, strip_parens(strip_commas(expanded_to))); strcpy(expanded_to, very_long_buffer); Index: src/syscall.c Prereq: 4.1 *** ../elm2.3/src/syscall.c Sat Apr 28 22:44:19 1990 --- src/syscall.c Sat Jun 9 22:00:14 1990 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: syscall.c,v 4.1 90/04/28 22:44:18 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: syscall.c,v 4.1.1.2 90/06/09 22:00:13 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.2 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 14,19 **** --- 14,30 ---- * ******************************************************************************* * $Log: syscall.c,v $ + * Revision 4.1.1.2 90/06/09 22:00:13 syd + * Use a close-on-exec pipe to diagnose exec() failures. + * From: tct!chip@uunet.UU.NET (Chip Salzenberg) + * + * Revision 4.1.1.1 90/06/09 21:33:22 syd + * Some wait system calls return with -1 and errno=4 (interrupted system call) when the + * editor is invoked, suspended, and then resumed. Loop until wait returns pid, or + * returns -1 *if errno != EINTR*. If wait returns -1 and errno = EINTR, we wait again. + * Some flock()s refuse to exclusively lock a fd open for read-only access. + * From: pdc%lunch.wpd@sgi.com (Paul Close) + * * Revision 4.1 90/04/28 22:44:18 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 28,33 **** --- 39,45 ---- #include "headers.h" #include <signal.h> + #include <errno.h> #ifdef BSD # include <sys/wait.h> *************** *** 111,117 **** a message being edited when a user connection is dropped is recovered by vi's expreserve program **/ ! int stat = 0, pid, w; #if defined(BSD) && !defined(WEXITSTATUS) union wait status; #else --- 123,130 ---- a message being edited when a user connection is dropped is recovered by vi's expreserve program **/ ! int pfd[2], stat, pid, w, iteration; ! char *sh; #if defined(BSD) && !defined(WEXITSTATUS) union wait status; #else *************** *** 128,175 **** register int (*oldstop)(), (*oldstart)(); # endif #endif ! ! dprint(2, (debugfile, ! "System Call: %s\n\t%s\n", shell_type == SH? "/bin/sh" : shell, ! string)); ! #ifdef VFORK ! if ((pid = vfork()) == 0) ! #else ! if ((pid = fork()) == 0) ! #endif ! { ! setgid(groupid); /* and group id */ ! setuid(userid); /* back to the normal user! */ ! if(allow_signals) { ! /* program to exec should handle interrupt, accidental hangup, and stop signals */ ! (void)signal(SIGHUP, SIG_DFL); ! if (allow_interrupt) ! (void)signal(SIGINT, SIG_DFL); ! else ! (void)signal(SIGINT, SIG_IGN); ! #ifdef SIGTSTP ! (void)signal(SIGTSTP, SIG_DFL); ! (void)signal(SIGCONT, SIG_DFL); ! #endif ! } else { ! /* program to exec should ignore interrupt, accidental hangup, and stop signals */ ! (void)signal(SIGHUP, SIG_IGN); ! (void)signal(SIGINT, SIG_IGN); ! #ifdef SIGTSTP ! (void)signal(SIGTSTP, SIG_IGN); ! (void)signal(SIGCONT, SIG_IGN); ! #endif ! } ! if (strlen(shell) > 0 && shell_type == USER_SHELL) { ! execl(shell, argv_zero(shell), "-c", string, (char *) 0); ! } ! else ! execl("/bin/sh", "sh", "-c", string, (char *) 0); ! _exit(127); } istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); --- 141,165 ---- register int (*oldstop)(), (*oldstart)(); # endif #endif ! extern int errno; ! sh = (shell_type == USER_SHELL) ? shell : "/bin/sh"; ! dprint(2, (debugfile, "System Call: %s\n\t%s\n", sh, string)); ! /* ! * Note the neat trick with close-on-exec pipes. ! * If the child's exec() succeeds, then the pipe read returns zero. ! * Otherwise, it returns the zero byte written by the child ! * after the exec() is attempted. This is the cleanest way I know ! * to discover whether an exec() failed. --CHS ! */ ! if (pipe(pfd) == -1) { ! perror("pipe"); ! return -1; } + fcntl(pfd[0], F_SETFD, 1); + fcntl(pfd[1], F_SETFD, 1); istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); *************** *** 178,204 **** oldstart = signal(SIGCONT, SIG_DFL); #endif ! while ((w = wait(&status)) != pid && w != -1) ! ; ! if (w == pid) { #ifdef WEXITSTATUS ! stat = WEXITSTATUS(status); #else # ifdef BSD ! if (status.w_retcode != 0) stat = status.w_retcode; # else ! stat = status; # endif #endif ! } ! ! (void)signal(SIGINT, istat); ! (void)signal(SIGQUIT, qstat); #ifdef SIGTSTP ! (void)signal(SIGTSTP, oldstop); ! (void)signal(SIGCONT, oldstart); #endif return(stat); --- 168,254 ---- oldstart = signal(SIGCONT, SIG_DFL); #endif ! stat = -1; /* Assume failure. */ + for (iteration = 0; iteration < 5; ++iteration) { + if (iteration > 0) + sleep(2); ! #ifdef VFORK ! pid = vfork(); ! #else ! pid = fork(); ! #endif ! ! if (pid != -1) ! break; ! } ! ! if (pid == -1) { ! perror("fork"); ! } ! else if (pid == 0) { ! /* ! * Set group and user back to their original values. ! * Note that group must be set first. ! */ ! setgid(groupid); ! setuid(userid); ! ! /* ! * Program to exec may or may not be able to handle ! * interrupt, quit, hangup and stop signals. ! */ ! (void) signal(SIGHUP, allow_signals ? SIG_DFL : SIG_IGN); ! (void) signal(SIGINT, (allow_signals && allow_interrupt)?SIG_DFL:SIG_IGN); ! (void) signal(SIGQUIT, (allow_signals && allow_interrupt)?SIG_DFL:SIG_IGN); ! #ifdef SIGTSTP ! (void) signal(SIGTSTP, allow_signals ? SIG_DFL : SIG_IGN); ! (void) signal(SIGCONT, allow_signals ? SIG_DFL : SIG_IGN); ! #endif ! ! /* Go for it. */ ! execl(sh, argv_zero(sh), "-c", string, (char *) 0); ! ! /* If exec fails, we write a byte to the pipe before exiting. */ ! perror(sh); ! write(pfd[1], "", 1); ! _exit(127); ! } ! else { ! int rd; ! char ch; ! ! /* Try to read a byte from the pipe. */ ! close(pfd[1]); ! rd = read(pfd[0], &ch, 1); ! close(pfd[0]); ! ! while ((w = wait(&status)) != pid) ! if (w == -1 && errno != EINTR) ! break; ! ! /* If we read a byte from the pipe, the exec failed. */ ! if (rd > 0) ! stat = -1; ! else if (w == pid) { #ifdef WEXITSTATUS ! stat = WEXITSTATUS(status); #else # ifdef BSD ! stat = status.w_retcode; # else ! stat = status; # endif #endif ! } ! } ! ! (void) signal(SIGINT, istat); ! (void) signal(SIGQUIT, qstat); #ifdef SIGTSTP ! (void) signal(SIGTSTP, oldstop); ! (void) signal(SIGCONT, oldstart); #endif return(stat); exit 0 # Just in case... -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. Use a domain-based address or give alternate paths, or you may lose out.