From 7ee298c98018a1e86023fd3fdc09a28f99c9b0b7 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 19 Sep 2001 16:52:20 +0000 Subject: [PATCH] Handle failure of sysconf and pick a fixed size buffer. (Happens on Cygwin Wed Sep 19 12:49:11 2001 Owen Taylor * glib/gutils.c (g_get_any_init): Handle failure of sysconf and pick a fixed size buffer. (Happens on Cygwin #60242) --- ChangeLog | 6 ++++++ ChangeLog.pre-2-0 | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-12 | 6 ++++++ ChangeLog.pre-2-2 | 6 ++++++ ChangeLog.pre-2-4 | 6 ++++++ ChangeLog.pre-2-6 | 6 ++++++ ChangeLog.pre-2-8 | 6 ++++++ glib/gutils.c | 7 +++++-- 9 files changed, 53 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 057a98a96..fb5964ca6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Sep 19 12:49:11 2001 Owen Taylor + + * glib/gutils.c (g_get_any_init): Handle failure of + sysconf and pick a fixed size buffer. (Happens on Cygwin + #60242) + Wed Sep 19 11:23:41 2001 Owen Taylor * configure.in: Error out if gettext support is not found. (#59386) diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 057a98a96..fb5964ca6 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,9 @@ +Wed Sep 19 12:49:11 2001 Owen Taylor + + * glib/gutils.c (g_get_any_init): Handle failure of + sysconf and pick a fixed size buffer. (Happens on Cygwin + #60242) + Wed Sep 19 11:23:41 2001 Owen Taylor * configure.in: Error out if gettext support is not found. (#59386) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 057a98a96..fb5964ca6 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Wed Sep 19 12:49:11 2001 Owen Taylor + + * glib/gutils.c (g_get_any_init): Handle failure of + sysconf and pick a fixed size buffer. (Happens on Cygwin + #60242) + Wed Sep 19 11:23:41 2001 Owen Taylor * configure.in: Error out if gettext support is not found. (#59386) diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 057a98a96..fb5964ca6 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,9 @@ +Wed Sep 19 12:49:11 2001 Owen Taylor + + * glib/gutils.c (g_get_any_init): Handle failure of + sysconf and pick a fixed size buffer. (Happens on Cygwin + #60242) + Wed Sep 19 11:23:41 2001 Owen Taylor * configure.in: Error out if gettext support is not found. (#59386) diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 057a98a96..fb5964ca6 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,9 @@ +Wed Sep 19 12:49:11 2001 Owen Taylor + + * glib/gutils.c (g_get_any_init): Handle failure of + sysconf and pick a fixed size buffer. (Happens on Cygwin + #60242) + Wed Sep 19 11:23:41 2001 Owen Taylor * configure.in: Error out if gettext support is not found. (#59386) diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 057a98a96..fb5964ca6 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Wed Sep 19 12:49:11 2001 Owen Taylor + + * glib/gutils.c (g_get_any_init): Handle failure of + sysconf and pick a fixed size buffer. (Happens on Cygwin + #60242) + Wed Sep 19 11:23:41 2001 Owen Taylor * configure.in: Error out if gettext support is not found. (#59386) diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 057a98a96..fb5964ca6 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Wed Sep 19 12:49:11 2001 Owen Taylor + + * glib/gutils.c (g_get_any_init): Handle failure of + sysconf and pick a fixed size buffer. (Happens on Cygwin + #60242) + Wed Sep 19 11:23:41 2001 Owen Taylor * configure.in: Error out if gettext support is not found. (#59386) diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 057a98a96..fb5964ca6 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Wed Sep 19 12:49:11 2001 Owen Taylor + + * glib/gutils.c (g_get_any_init): Handle failure of + sysconf and pick a fixed size buffer. (Happens on Cygwin + #60242) + Wed Sep 19 11:23:41 2001 Owen Taylor * configure.in: Error out if gettext support is not found. (#59386) diff --git a/glib/gutils.c b/glib/gutils.c index fd8458bf0..a9048ac3e 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -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 {