freebsd-ports/devel/glib12/files/patch-gutils.c
Joe Marcus Clarke 253d4c8ad2 getpw*_r is now implemented in -CURRENT. However, the _SC_GETPW_R_SIZE_MAX
sysconf is not.  This causes glib to try and malloc UINT_MAX bytes of memeory
which basically translates to -1 bytes.  Sanity check the value returned by
sysconf (_SC_GETPW_R_SIZE_MAX) to see that it's really implemented.  This
fixes an abort people started to see in Glib-based applications.

Reported by:	Shin-ichi YOSHIMOTO <yosimoto@waishi.jp>
2003-04-19 10:15:29 +00:00

10 lines
426 B
C

--- gutils.c.orig Wed Aug 9 14:12:31 2000
+++ gutils.c Sat Apr 19 06:09:28 2003
@@ -483,6 +483,7 @@
# ifdef _SC_GETPW_R_SIZE_MAX
/* This reurns the maximum length */
guint bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
+ if (bufsize == UINT_MAX) bufsize = 64; /* XXX Correct for unimpelemented SC */
# else /* _SC_GETPW_R_SIZE_MAX */
guint bufsize = 64;
# endif /* _SC_GETPW_R_SIZE_MAX */