[dovecot-cvs] dovecot/src/lib failures.c,1.6,1.7 fd-close-on-exec.c,1.1,1.2 randgen.c,1.3,1.4
cras at procontrol.fi
cras at procontrol.fi
Sun Dec 1 17:58:38 EET 2002
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv4610/lib
Modified Files:
failures.c fd-close-on-exec.c randgen.c
Log Message:
Set close-on-exec flag to failure log, /dev/urandom fd already tried to do
that but did it wrong.
Index: failures.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/failures.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- failures.c 1 Dec 2002 15:48:46 -0000 1.6
+++ failures.c 1 Dec 2002 15:58:36 -0000 1.7
@@ -26,6 +26,7 @@
#include "lib.h"
#include "ioloop.h"
+#include "fd-close-on-exec.h"
#include <stdio.h>
#include <stdlib.h>
@@ -218,6 +219,7 @@
log_fd = fopen(path, "a");
if (log_fd == NULL)
i_fatal("Can't open log file %s: %m", path);
+ fd_close_on_exec(fileno(log_fd), TRUE);
i_free(log_prefix);
log_prefix = i_strconcat(prefix, ": ", NULL);
Index: fd-close-on-exec.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/fd-close-on-exec.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- fd-close-on-exec.c 1 Dec 2002 15:39:20 -0000 1.1
+++ fd-close-on-exec.c 1 Dec 2002 15:58:36 -0000 1.2
@@ -44,7 +44,7 @@
{
while (first_fd < last_fd) {
if (fcntl(first_fd, F_GETFD, 0) != -1 || errno != EBADF)
- i_fatal("Leaked file descriptor: %d", first_fd);
+ i_panic("Leaked file descriptor: %d", first_fd);
first_fd++;
}
}
Index: randgen.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/randgen.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- randgen.c 8 Sep 2002 13:20:28 -0000 1.3
+++ randgen.c 1 Dec 2002 15:58:36 -0000 1.4
@@ -24,6 +24,7 @@
*/
#include "lib.h"
+#include "fd-close-on-exec.h"
#include "randgen.h"
#include <unistd.h>
@@ -62,8 +63,7 @@
}
}
- if (fcntl(urandom_fd, FD_CLOEXEC, 1L) < 0)
- i_fatal("Error setting close-on-exec flag to /dev/urandom: %m");
+ fd_close_on_exec(urandom_fd, TRUE);
}
void random_deinit(void)
More information about the dovecot-cvs
mailing list