7 /* set task name for logging purposes
9 /* #include <mail_task.h>
11 /* const char *mail_task(argv0)
14 /* mail_task() enforces consistent naming of mailer processes.
15 /* It strips pathname information from the process name, and
16 /* prepends the name of the mail system so that logfile entries
17 /* are easier to recognize. The mail system name is specified
18 /* with the "syslog_name" configuration parameter.
20 /* The result is volatile. Make a copy of the result if it is
21 /* to be used for any appreciable amount of time.
25 /* The Secure Mailer license must be distributed with this software.
28 /* IBM T.J. Watson Research
30 /* Yorktown Heights, NY 10598, USA
38 /* Utility library. */
45 #include "mail_params.h"
46 #include "mail_conf.h"
47 #include "mail_task.h"
49 /* mail_task - clean up and decorate the process name */
51 const char *mail_task(const char *argv0
)
53 static VSTRING
*canon_name
;
58 canon_name
= vstring_alloc(10);
59 if ((slash
= strrchr(argv0
, '/')) != 0 && slash
[1])
61 /* Setenv()-ed from main.cf, or inherited from master. */
62 if ((tag
= safe_getenv(CONF_ENV_LOGTAG
)) == 0)
63 /* Check main.cf settings directly, in case set-gid. */
64 tag
= var_syslog_name
? var_syslog_name
:
65 mail_conf_eval(DEF_SYSLOG_NAME
);
66 vstring_sprintf(canon_name
, "%s/%s", tag
, argv0
);
67 return (vstring_str(canon_name
));