Handle failure of sysconf and pick a fixed size buffer. (Happens on Cygwin

Wed Sep 19 12:49:11 2001  Owen Taylor  <otaylor@redhat.com>

	* glib/gutils.c (g_get_any_init): Handle failure of
	sysconf and pick a fixed size buffer. (Happens on Cygwin
	#60242)
This commit is contained in:
Owen Taylor
2001-09-19 16:52:20 +00:00
committed by Owen Taylor
parent 37fd6f79d4
commit 7ee298c980
9 changed files with 53 additions and 2 deletions

View File

@@ -822,16 +822,19 @@ g_get_any_init (void)
{
struct passwd *pw = NULL;
gpointer buffer = NULL;
gint error;
# if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
struct passwd pwd;
# ifdef _SC_GETPW_R_SIZE_MAX
/* This reurns the maximum length */
glong bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
glong bufsize = sysconf (_SC_GETPW_R_SIZE_MAX);
if (bufsize < 0)
bufsize = 64;
# else /* _SC_GETPW_R_SIZE_MAX */
glong bufsize = 64;
# endif /* _SC_GETPW_R_SIZE_MAX */
gint error;
do
{