[dovecot-cvs] dovecot/src/master auth-process.c,1.33,1.34 mail-process.c,1.2,1.3 main.c,1.33,1.34 master-login-interface.h,1.2,1.3
cras at procontrol.fi
cras at procontrol.fi
Sat Feb 8 17:42:48 EET 2003
Update of /home/cvs/dovecot/src/master
In directory danu:/tmp/cvs-serv21601/src/master
Modified Files:
auth-process.c mail-process.c main.c master-login-interface.h
Log Message:
/dev/stderr works now in log paths.
Index: auth-process.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/auth-process.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- auth-process.c 8 Feb 2003 09:31:00 -0000 1.33
+++ auth-process.c 8 Feb 2003 15:42:46 -0000 1.34
@@ -293,12 +293,10 @@
(void)close(fd[0]);
(void)close(fd[1]);
- /* set /dev/null handle into 1 and 2, so if something is printed into
- stdout/stderr it can't go anywhere where it could cause harm */
+ /* set stdout to /dev/null, so anything written into it gets ignored.
+ leave stderr alone, we might want to use it for logging. */
if (dup2(null_fd, 1) < 0)
i_fatal("login: dup2(1) failed: %m");
- if (dup2(null_fd, 2) < 0)
- i_fatal("login: dup2(2) failed: %m");
clean_child_process();
Index: mail-process.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/mail-process.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mail-process.c 1 Feb 2003 02:06:12 -0000 1.2
+++ mail-process.c 8 Feb 2003 15:42:46 -0000 1.3
@@ -140,8 +140,6 @@
i_fatal("mail: dup2(stdin) failed: %m");
if (dup2(socket, 1) < 0)
i_fatal("mail: dup2(stdout) failed: %m");
- if (dup2(null_fd, 2) < 0)
- i_fatal("mail: dup2(stderr) failed: %m");
if (close(socket) < 0)
i_error("mail: close(mail client) failed: %m");
Index: main.c
===================================================================
RCS file: /home/cvs/dovecot/src/master/main.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- main.c 8 Feb 2003 07:40:36 -0000 1.33
+++ main.c 8 Feb 2003 15:42:46 -0000 1.34
@@ -281,6 +281,21 @@
fd_close_on_exec(mail_fd[i], TRUE);
}
}
+
+ /* close stdin and stdout. close stderr unless we're logging
+ into /dev/stderr. */
+ if (dup2(null_fd, 0) < 0)
+ i_fatal("dup2(0) failed: %m");
+ if (dup2(null_fd, 1) < 0)
+ i_fatal("dup2(1) failed: %m");
+
+ if ((set->log_path == NULL ||
+ strcmp(set->log_path, "/dev/stderr") != 0) &&
+ (set->info_log_path == NULL ||
+ strcmp(set->info_log_path, "/dev/stderr") != 0)) {
+ if (dup2(null_fd, 2) < 0)
+ i_fatal("dup(0) failed: %m");
+ }
}
static void open_logfile(void)
Index: master-login-interface.h
===================================================================
RCS file: /home/cvs/dovecot/src/master/master-login-interface.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- master-login-interface.h 30 Jan 2003 17:59:32 -0000 1.2
+++ master-login-interface.h 8 Feb 2003 15:42:46 -0000 1.3
@@ -5,7 +5,7 @@
#define LOGIN_MASTER_SOCKET_FD 0
#define LOGIN_LISTEN_FD 1
-#define LOGIN_SSL_LISTEN_FD 2
+#define LOGIN_SSL_LISTEN_FD 3
struct master_login_request {
unsigned int tag;
More information about the dovecot-cvs
mailing list