From: Timo Sirainen Date: Tue, 5 Aug 2008 00:34:35 +0000 (-0400) Subject: dovecot-auth: Give a nice error message if you try to run it manually. X-Git-Tag: 1.2.alpha1~92 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f05a995eff2bc007d70cdbdd0ff9b803b9e707da;p=thirdparty%2Fdovecot%2Fcore.git dovecot-auth: Give a nice error message if you try to run it manually. --HG-- branch : HEAD --- diff --git a/src/auth/main.c b/src/auth/main.c index 110f7288e5..6ac13ebda9 100644 --- a/src/auth/main.c +++ b/src/auth/main.c @@ -188,6 +188,14 @@ static void drop_privileges(void) "(if you don't care, set version_ignore=yes)", version); } + standalone = getenv("DOVECOT_MASTER") == NULL; + if (standalone && getenv("AUTH_1") == NULL) { + i_fatal("dovecot-auth is usually started through " + "dovecot master process. If you wish to run " + "it standalone, you'll need to set AUTH_* " + "environment variables (AUTH_1 isn't set)."); + } + open_logfile(); /* Open /dev/urandom before chrooting */ @@ -239,16 +247,8 @@ static void main_init(bool nodaemon) return; } - standalone = getenv("DOVECOT_MASTER") == NULL; - if (standalone) { + if (getenv("DOVECOT_MASTER") == NULL) { /* starting standalone */ - if (getenv("AUTH_1") == NULL) { - i_fatal("dovecot-auth is usually started through " - "dovecot master process. If you wish to run " - "it standalone, you'll need to set AUTH_* " - "environment variables (AUTH_1 isn't set)."); - } - if (!nodaemon) { switch (fork()) { case -1: