commit 36cbdf6d5478219a9148df9832ec2742a6214e94
Author: Florian G. Pflug <fgp@phlo.org>
Date:   Tue Jan 11 14:25:58 2011 +0100

    Arrange for syslog messaged to be written to stderr also by passing LOG_PERROR to openlog()

diff --git a/imap/global.c b/imap/global.c
index 541709f..6b5f2b9 100644
--- a/imap/global.c
+++ b/imap/global.c
@@ -135,7 +135,7 @@ int cyrus_init(const char *alt_config, const char *ident, unsigned flags)
     
     /* xxx we lose here since we can't have the prefix until we load the
      * config file */
-    openlog(config_ident, LOG_PID, SYSLOG_FACILITY);
+    openlog(config_ident, LOG_PID | LOG_PERROR, SYSLOG_FACILITY);
 
     /* Load configuration file.  This will set config_dir when it finds it */
     config_read(alt_config);
@@ -152,7 +152,7 @@ int cyrus_init(const char *alt_config, const char *ident, unsigned flags)
 	strlcat(ident_buf, ident, size);
 
 	closelog();
-	openlog(ident_buf, LOG_PID, SYSLOG_FACILITY);
+	openlog(ident_buf, LOG_PID | LOG_PERROR, SYSLOG_FACILITY);
 
 	/* don't free the openlog() string! */
     }
diff --git a/master/masterconf.c b/master/masterconf.c
index 54f384c..2f982d5 100644
--- a/master/masterconf.c
+++ b/master/masterconf.c
@@ -78,7 +78,7 @@ int masterconf_init(const char *ident, const char *alt_config)
 
     /* Open the log file with the appropriate facility so we 
      * correctly log any config errors */
-    openlog(ident, LOG_PID, SYSLOG_FACILITY);
+    openlog(ident, LOG_PID | LOG_PERROR, SYSLOG_FACILITY);
 
     config_ident = ident;
     config_read(alt_config);
@@ -94,7 +94,7 @@ int masterconf_init(const char *ident, const char *alt_config)
 
 	/* Reopen the log with the new prefix */
 	closelog();
-	openlog(buf, LOG_PID, SYSLOG_FACILITY);
+	openlog(buf, LOG_PID | LOG_PERROR, SYSLOG_FACILITY);
 
         /* don't free the openlog() string! */
     }
diff --git a/master/service.c b/master/service.c
index f3746ad..8957fd3 100644
--- a/master/service.c
+++ b/master/service.c
@@ -566,10 +566,6 @@ int main(int argc, char **argv, char **envp)
 	    syslog(LOG_ERR, "can't duplicate accepted socket: %m");
 	    service_abort(EX_OSERR);
 	}
-	if (fd != 2 && dup2(fd, 2) < 0) {
-	    syslog(LOG_ERR, "can't duplicate accepted socket: %m");
-	    service_abort(EX_OSERR);
-	}
 
 	/* tcp only */
 	if(soctype == SOCK_STREAM) {
diff --git a/ptclient/ptexpire.c b/ptclient/ptexpire.c
index a4e9f69..f67e17d 100644
--- a/ptclient/ptexpire.c
+++ b/ptclient/ptexpire.c
@@ -118,7 +118,7 @@ int main(int argc, char *argv[])
 	fatal("must run as the Cyrus user", EC_USAGE);
     }
     
-    openlog("ptexpire", LOG_PID, SYSLOG_FACILITY);
+    openlog("ptexpire", LOG_PID | LOG_PERROR, SYSLOG_FACILITY);
 
     while ((opt = getopt(argc, argv, "C:E:")) != EOF) {
 	switch (opt) {
diff --git a/syslog/syslog.c b/syslog/syslog.c
index 329b065..7104062 100644
--- a/syslog/syslog.c
+++ b/syslog/syslog.c
@@ -158,7 +158,7 @@ vsyslog(pri, fmt, ap)
 
         /* Get connected. */
         if (!connected)
-                openlog(LogTag, LogStat | LOG_NDELAY, 0);
+                openlog(LogTag, LogStat | LOG_NDELAY | LOG_PERROR, 0);
 
         /* Build the message. */
         (void)time(&now);
