dovecot-2.0: i_getgr*(): Use a generic workaround for all OSes t...

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 16 23:00:18 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/e4aa32586f17
changeset: 12976:e4aa32586f17
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 16 22:59:36 2011 +0200
description:
i_getgr*(): Use a generic workaround for all OSes that report too small grbuf size.

diffstat:

 src/lib/ipwd.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (20 lines):

diff -r 57b4c6b7f407 -r e4aa32586f17 src/lib/ipwd.c
--- a/src/lib/ipwd.c	Wed Nov 16 22:24:31 2011 +0200
+++ b/src/lib/ipwd.c	Wed Nov 16 22:59:36 2011 +0200
@@ -31,11 +31,12 @@
 	long size;
 
 	if (grbuf == NULL) {
-		/* OpenBSD up to 4.9 reports too low value in sysconf() */
-#if !defined(__OpenBSD__) || OpenBSD >= 201111
 		size = sysconf(_SC_GETGR_R_SIZE_MAX);
-		if (size < 0)
-#endif
+		/* Some BSDs return too low value for this. instead of trying
+		   to figure out exactly which, just make sure it's at least
+		   a reasonable size. if the real size is smaller, it doesn't
+		   matter much that we waste a few kilobytes of memory. */
+		if (size < DEFAULT_GRBUF_SIZE)
 			size = DEFAULT_GRBUF_SIZE;
 
 		grbuf_size = size;


More information about the dovecot-cvs mailing list