377 #include <sys/stat.h>
408 static char *var_sendmail_path;
409 static char *var_mailq_path;
410 static char *var_newalias_path;
411 static char *var_manpage_dir;
412 static char *var_sample_dir;
413 static char *var_readme_dir;
414 static char *var_html_dir;
418 static void check_setenv(
char *name,
char *value)
421 if (setenv(name, value,
CLOBBER) < 0)
429 int main(
int argc,
char **argv)
447 int force_single_instance;
465 for (fd = 0; fd < 3; fd++)
466 if (
fstat(fd, &st) == -1
467 && (close(fd), open(
"/dev/null", O_RDWR, 0)) != fd)
475 if ((slash = strrchr(argv[0],
'/')) != 0 && slash[1])
477 if (isatty(STDERR_FILENO))
492 msg_error(
"to submit mail, use the Postfix sendmail command");
493 msg_fatal(
"the postfix command is reserved for the superuser");
496 msg_fatal(
"the postfix command must not run as a set-uid process");
501 while ((ch =
GETOPT(argc, argv,
"c:Dv")) > 0) {
504 msg_fatal(
"usage: %s [-c config_dir] [-Dv] command", argv[0]);
507 msg_fatal(
"-c requires absolute pathname");
533 msg_info(
"Postfix is running with backwards-compatible default "
535 msg_info(
"See http://www.postfix.org/COMPATIBILITY_README.html "
537 msg_info(
"To disable backwards compatibility use \"postconf "
552 check_setenv(
"PATH", ROOT_PATH);
590 if (force_single_instance
595 argv[optind - 1] = script;
596 execvp(script, argv + optind - 1);
605 msg_fatal(
"multi-instance support is requested, but %s is empty",
609 argv_add(my_argv, argv[optind], (
char *) 0);
610 }
while (argv[optind++] != 0);
611 execvp(my_argv->
argv[0], my_argv->
argv);
void msg_error(const char *fmt,...)
char * var_import_environ
ARGV * argv_free(ARGV *argvp)
#define VAR_IMPORT_ENVIRON
NORETURN msg_panic(const char *fmt,...)
char * var_multi_conf_dirs
void argv_add(ARGV *argvp,...)
void mail_conf_read(void)
void clean_env(char **preserve_list)
ARGV * mail_parm_split(const char *name, const char *value)
MAIL_VERSION_STAMP_DECLARE
#define MAIL_VERSION_STAMP_ALLOCATE
void get_mail_conf_str_table(const CONFIG_STR_TABLE *)
NORETURN msg_fatal(const char *fmt,...)
#define MAIL_VERSION_CHECK
#define VAR_MULTI_WRAPPER
char * concatenate(const char *arg0,...)
#define DEF_SENDMAIL_PATH
ARGV * argv_split(const char *, const char *)
#define GETOPT(argc, argv, str)
void msg_syslog_init(const char *name, int logopt, int facility)
#define VAR_SENDMAIL_PATH
void msg_vstream_init(const char *name, VSTREAM *vp)
int main(int argc, char **argv)
#define DEF_NEWALIAS_PATH
#define VAR_NEWALIAS_PATH
void msg_info(const char *fmt,...)