summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/sendmail/src/main.c')
-rw-r--r--contrib/sendmail/src/main.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index f274ad8..45ea1ed 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -25,7 +25,7 @@ SM_UNUSED(static char copyright[]) =
The Regents of the University of California. All rights reserved.\n";
#endif /* ! lint */
-SM_RCSID("@(#)$Id: main.c,v 8.939 2004/06/17 16:39:21 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.942 2005/12/26 04:39:13 ca Exp $")
#if NETINET || NETINET6
@@ -649,7 +649,7 @@ main(argc, argv, envp)
}
/* prime the child environment */
- setuserenv("AGENT", "sendmail");
+ sm_setuserenv("AGENT", "sendmail");
(void) sm_signal(SIGPIPE, SIG_IGN);
OldUmask = umask(022);
@@ -1318,9 +1318,9 @@ main(argc, argv, envp)
if (TimeZoneSpec == NULL)
unsetenv("TZ");
else if (TimeZoneSpec[0] != '\0')
- setuserenv("TZ", TimeZoneSpec);
+ sm_setuserenv("TZ", TimeZoneSpec);
else
- setuserenv("TZ", NULL);
+ sm_setuserenv("TZ", NULL);
tzset();
/* initialize mailbox database */
@@ -1462,6 +1462,16 @@ main(argc, argv, envp)
"Warning: HostStatusDirectory required for SingleThreadDelivery\n");
}
+#if _FFR_MEMSTAT
+ j = sm_memstat_open();
+ if (j < 0 && (RefuseLowMem > 0 || QueueLowMem > 0) && LogLevel > 4)
+ {
+ sm_syslog(LOG_WARNING, NOQID,
+ "cannot get memory statistics, settings ignored, error=%d"
+ , j);
+ }
+#endif /* _FFR_MEMSTAT */
+
/* check for permissions */
if (RealUid != 0 &&
RealUid != TrustedUid)
@@ -2949,6 +2959,9 @@ finis(drop, cleanup, exitstat)
/* reset uid for process accounting */
endpwent();
sm_mbdb_terminate();
+#if _FFR_MEMSTAT
+ (void) sm_memstat_close();
+#endif /* _FFR_MEMSTAT */
(void) setuid(RealUid);
#if SM_HEAP_CHECK
/* dump the heap, if we are checking for memory leaks */
@@ -3439,21 +3452,21 @@ getextenv(envar)
return NULL;
}
/*
-** SETUSERENV -- set an environment in the propagated environment
+** SM_SETUSERENV -- set an environment variable in the propagated environment
**
** Parameters:
** envar -- the name of the environment variable.
** value -- the value to which it should be set. If
** null, this is extracted from the incoming
** environment. If that is not set, the call
-** to setuserenv is ignored.
+** to sm_setuserenv is ignored.
**
** Returns:
** none.
*/
void
-setuserenv(envar, value)
+sm_setuserenv(envar, value)
const char *envar;
const char *value;
{
@@ -3488,7 +3501,7 @@ setuserenv(envar, value)
/* make sure it is in our environment as well */
if (putenv(p) < 0)
- syserr("setuserenv: putenv(%s) failed", p);
+ syserr("sm_setuserenv: putenv(%s) failed", p);
}
/*
** DUMPSTATE -- dump state
OpenPOWER on IntegriCloud