From f05a995eff2bc007d70cdbdd0ff9b803b9e707da Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 4 Aug 2008 20:34:35 -0400 Subject: [PATCH] dovecot-auth: Give a nice error message if you try to run it manually. --HG-- branch : HEAD --- src/auth/main.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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: -- 2.47.3