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

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 16 22:59:58 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/b0c0d11792fc
changeset: 13717:b0c0d11792fc
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 0a94dfe6ac92 -r b0c0d11792fc src/lib/ipwd.c
--- a/src/lib/ipwd.c	Wed Nov 16 22:13:35 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