]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
i_getgr*(): Use a generic workaround for all OSes that report too small grbuf size.
authorTimo Sirainen <tss@iki.fi>
Wed, 16 Nov 2011 20:59:36 +0000 (22:59 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 16 Nov 2011 20:59:36 +0000 (22:59 +0200)
src/lib/ipwd.c

index bb2e921bf499aa362353fb4d9a75a8b5a37c60b2..726b2f96e4626eee66761fcaac888b0056d421a2 100644 (file)
@@ -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;