From: Timo Sirainen Date: Wed, 16 Nov 2011 20:59:36 +0000 (+0200) Subject: i_getgr*(): Use a generic workaround for all OSes that report too small grbuf size. X-Git-Tag: 2.1.rc1~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5cc9289a900f5d40d126ca663790dca2a7456416;p=thirdparty%2Fdovecot%2Fcore.git i_getgr*(): Use a generic workaround for all OSes that report too small grbuf size. --- diff --git a/src/lib/ipwd.c b/src/lib/ipwd.c index bb2e921bf4..726b2f96e4 100644 --- a/src/lib/ipwd.c +++ b/src/lib/ipwd.c @@ -31,11 +31,12 @@ static void gr_init(void) 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;