dovecot-1.2: threadview: If mmap() fails, fail with an error ins...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 17 01:55:39 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/fd2869cf92fd
changeset: 9140:fd2869cf92fd
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 16 18:55:34 2009 -0400
description:
threadview: If mmap() fails, fail with an error instead of crashing.

diffstat:

1 file changed, 2 insertions(+)
src/util/threadview.c |    2 ++

diffs (12 lines):

diff -r 17e87db4e97c -r fd2869cf92fd src/util/threadview.c
--- a/src/util/threadview.c	Tue Jun 16 14:41:02 2009 -0400
+++ b/src/util/threadview.c	Tue Jun 16 18:55:34 2009 -0400
@@ -163,6 +163,8 @@ int main(int argc, const char *argv[])
 	max_likely_index = (st.st_size / 8) * 2;
 
 	map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+	if (map == MAP_FAILED)
+		i_fatal("mmap() failed: %m");
 	end = CONST_PTR_OFFSET(map, st.st_size);
 	pos = dump_hdr(map);
 	uid = 0;


More information about the dovecot-cvs mailing list