in FIN_WAIT_2 for extended periods; bug in -X setvbuf call
SCCS-vsn: usr.sbin/sendmail/src/main.c 8.4
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)main.c 8.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c 8.4 (Berkeley) %G%";
#endif /* not lint */
#define _DEFINE
#endif /* not lint */
#define _DEFINE
# ifdef lint
char edata, end;
# ifdef lint
char edata, end;
/*
** SENDMAIL -- Post mail to a set of destinations.
/*
** SENDMAIL -- Post mail to a set of destinations.
break;
}
#ifdef HASSETVBUF
break;
}
#ifdef HASSETVBUF
- setvbuf(TrafficLogFile, NULL, _IOLBF, BUFSIZ);
+ setvbuf(TrafficLogFile, NULL, _IOLBF, 0);
#else
setlinebuf(TrafficLogFile);
#endif
#else
setlinebuf(TrafficLogFile);
#endif
exit(0);
/* disconnect from our controlling tty */
exit(0);
/* disconnect from our controlling tty */
- disconnect(TRUE, CurEnv);
if (*av == NULL && !GrabTo)
{
if (*av == NULL && !GrabTo)
{
+ CurEnv->e_flags |= EF_GLOBALERRS;
usrerr("Recipient names must be specified");
/* collect body for UUCP return */
usrerr("Recipient names must be specified");
/* collect body for UUCP return */
CurEnv->e_to = NULL;
if (OpMode != MD_VERIFY || GrabTo)
CurEnv->e_to = NULL;
if (OpMode != MD_VERIFY || GrabTo)
+ {
+ CurEnv->e_flags |= EF_GLOBALERRS;
collect(FALSE, FALSE, CurEnv);
collect(FALSE, FALSE, CurEnv);
errno = 0;
/* collect statistics */
errno = 0;
/* collect statistics */
** DISCONNECT -- remove our connection with any foreground process
**
** Parameters:
** DISCONNECT -- remove our connection with any foreground process
**
** Parameters:
-** fulldrop -- if set, we should also drop the controlling
-** TTY if possible -- this should only be done when
-** setting up the daemon since otherwise UUCP can
-** leave us trying to open a dialin, and we will
-** wait for the carrier.
+** droplev -- how "deeply" we should drop the line.
+** 0 -- ignore signals, mail back errors, make sure
+** output goes to stdout.
+** 1 -- also, make stdout go to transcript.
+** 2 -- also, disconnect from controlling terminal
+** (only for daemon mode).
+** e -- the current envelope.
** the controlling tty.
*/
** the controlling tty.
*/
-disconnect(fulldrop, e)
- bool fulldrop;
+disconnect(droplev, e)
+ int droplev;
register ENVELOPE *e;
{
int fd;
register ENVELOPE *e;
{
int fd;
(void) fclose(OutChannel);
OutChannel = stdout;
}
(void) fclose(OutChannel);
OutChannel = stdout;
}
- if (e->e_xfp == NULL)
- fd = open("/dev/null", O_WRONLY, 0666);
- else
- fd = fileno(e->e_xfp);
- (void) fflush(stdout);
- dup2(fd, STDOUT_FILENO);
- dup2(fd, STDERR_FILENO);
- if (e->e_xfp == NULL)
- close(fd);
+ if (droplev > 0)
+ {
+ if (e->e_xfp == NULL)
+ fd = open("/dev/null", O_WRONLY, 0666);
+ else
+ fd = fileno(e->e_xfp);
+ (void) fflush(stdout);
+ dup2(fd, STDOUT_FILENO);
+ dup2(fd, STDERR_FILENO);
+ if (e->e_xfp == NULL)
+ close(fd);
+ }
/* drop our controlling TTY completely if possible */
/* drop our controlling TTY completely if possible */
{
(void) setsid();
#ifdef TIOCNOTTY
{
(void) setsid();
#ifdef TIOCNOTTY