From def1947e4f40d92f904afab9d82cb8ac83d913c3 Mon Sep 17 00:00:00 2001 From: Sebastian Wilhelmi Date: Mon, 25 Jan 1999 09:53:17 +0000 Subject: [PATCH] Do not use the thread libs, when searching for some functions, as this 1999-01-25 Sebastian Wilhelmi * configure.in: Do not use the thread libs, when searching for some functions, as this might require glib to always be linked with the thread libs on some platforms. * gutils.c (g_get_any_init): Don't set errno to zero and use it only as the error code, if the function returned a value less 0. It might happen, that the call succeeds, even though the errno is set during the call (i.e. it first looks for a passwd file, which is not found). Submitted by Michael Natterer . BTW: Sorry for all the mess with that `getpwuid_r' change, but it had to be done once. --- ChangeLog | 14 ++++++++++++++ ChangeLog.pre-2-0 | 14 ++++++++++++++ ChangeLog.pre-2-10 | 14 ++++++++++++++ ChangeLog.pre-2-12 | 14 ++++++++++++++ ChangeLog.pre-2-2 | 14 ++++++++++++++ ChangeLog.pre-2-4 | 14 ++++++++++++++ ChangeLog.pre-2-6 | 14 ++++++++++++++ ChangeLog.pre-2-8 | 14 ++++++++++++++ configure.in | 4 +++- glib/gutils.c | 3 +-- gutils.c | 3 +-- 11 files changed, 117 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79be861a..c65957c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +1999-01-25 Sebastian Wilhelmi + + * configure.in: Do not use the thread libs, when searching for + some functions, as this might require glib to always be linked + with the thread libs on some platforms. + + * gutils.c (g_get_any_init): Don't set errno to zero and use it + only as the error code, if the function returned a value less + 0. It might happen, that the call succeeds, even though the errno + is set during the call (i.e. it first looks for a passwd file, + which is not found). Submitted by Michael Natterer + . BTW: Sorry for all the mess with that + `getpwuid_r' change, but it had to be done once. + Sun Jan 24 10:33:30 1999 Tim Janik * gutils.c (g_get_any_init): reverted raja's changes, since they leaked diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 79be861a..c65957c5 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,17 @@ +1999-01-25 Sebastian Wilhelmi + + * configure.in: Do not use the thread libs, when searching for + some functions, as this might require glib to always be linked + with the thread libs on some platforms. + + * gutils.c (g_get_any_init): Don't set errno to zero and use it + only as the error code, if the function returned a value less + 0. It might happen, that the call succeeds, even though the errno + is set during the call (i.e. it first looks for a passwd file, + which is not found). Submitted by Michael Natterer + . BTW: Sorry for all the mess with that + `getpwuid_r' change, but it had to be done once. + Sun Jan 24 10:33:30 1999 Tim Janik * gutils.c (g_get_any_init): reverted raja's changes, since they leaked diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 79be861a..c65957c5 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +1999-01-25 Sebastian Wilhelmi + + * configure.in: Do not use the thread libs, when searching for + some functions, as this might require glib to always be linked + with the thread libs on some platforms. + + * gutils.c (g_get_any_init): Don't set errno to zero and use it + only as the error code, if the function returned a value less + 0. It might happen, that the call succeeds, even though the errno + is set during the call (i.e. it first looks for a passwd file, + which is not found). Submitted by Michael Natterer + . BTW: Sorry for all the mess with that + `getpwuid_r' change, but it had to be done once. + Sun Jan 24 10:33:30 1999 Tim Janik * gutils.c (g_get_any_init): reverted raja's changes, since they leaked diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 79be861a..c65957c5 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,17 @@ +1999-01-25 Sebastian Wilhelmi + + * configure.in: Do not use the thread libs, when searching for + some functions, as this might require glib to always be linked + with the thread libs on some platforms. + + * gutils.c (g_get_any_init): Don't set errno to zero and use it + only as the error code, if the function returned a value less + 0. It might happen, that the call succeeds, even though the errno + is set during the call (i.e. it first looks for a passwd file, + which is not found). Submitted by Michael Natterer + . BTW: Sorry for all the mess with that + `getpwuid_r' change, but it had to be done once. + Sun Jan 24 10:33:30 1999 Tim Janik * gutils.c (g_get_any_init): reverted raja's changes, since they leaked diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 79be861a..c65957c5 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,17 @@ +1999-01-25 Sebastian Wilhelmi + + * configure.in: Do not use the thread libs, when searching for + some functions, as this might require glib to always be linked + with the thread libs on some platforms. + + * gutils.c (g_get_any_init): Don't set errno to zero and use it + only as the error code, if the function returned a value less + 0. It might happen, that the call succeeds, even though the errno + is set during the call (i.e. it first looks for a passwd file, + which is not found). Submitted by Michael Natterer + . BTW: Sorry for all the mess with that + `getpwuid_r' change, but it had to be done once. + Sun Jan 24 10:33:30 1999 Tim Janik * gutils.c (g_get_any_init): reverted raja's changes, since they leaked diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 79be861a..c65957c5 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,17 @@ +1999-01-25 Sebastian Wilhelmi + + * configure.in: Do not use the thread libs, when searching for + some functions, as this might require glib to always be linked + with the thread libs on some platforms. + + * gutils.c (g_get_any_init): Don't set errno to zero and use it + only as the error code, if the function returned a value less + 0. It might happen, that the call succeeds, even though the errno + is set during the call (i.e. it first looks for a passwd file, + which is not found). Submitted by Michael Natterer + . BTW: Sorry for all the mess with that + `getpwuid_r' change, but it had to be done once. + Sun Jan 24 10:33:30 1999 Tim Janik * gutils.c (g_get_any_init): reverted raja's changes, since they leaked diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 79be861a..c65957c5 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,17 @@ +1999-01-25 Sebastian Wilhelmi + + * configure.in: Do not use the thread libs, when searching for + some functions, as this might require glib to always be linked + with the thread libs on some platforms. + + * gutils.c (g_get_any_init): Don't set errno to zero and use it + only as the error code, if the function returned a value less + 0. It might happen, that the call succeeds, even though the errno + is set during the call (i.e. it first looks for a passwd file, + which is not found). Submitted by Michael Natterer + . BTW: Sorry for all the mess with that + `getpwuid_r' change, but it had to be done once. + Sun Jan 24 10:33:30 1999 Tim Janik * gutils.c (g_get_any_init): reverted raja's changes, since they leaked diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 79be861a..c65957c5 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,17 @@ +1999-01-25 Sebastian Wilhelmi + + * configure.in: Do not use the thread libs, when searching for + some functions, as this might require glib to always be linked + with the thread libs on some platforms. + + * gutils.c (g_get_any_init): Don't set errno to zero and use it + only as the error code, if the function returned a value less + 0. It might happen, that the call succeeds, even though the errno + is set during the call (i.e. it first looks for a passwd file, + which is not found). Submitted by Michael Natterer + . BTW: Sorry for all the mess with that + `getpwuid_r' change, but it had to be done once. + Sun Jan 24 10:33:30 1999 Tim Janik * gutils.c (g_get_any_init): reverted raja's changes, since they leaked diff --git a/configure.in b/configure.in index a1e21782..905d6199 100644 --- a/configure.in +++ b/configure.in @@ -690,7 +690,9 @@ dnl *********************************** if test x"$have_threads" != xnone; then glib_save_LIBS="$LIBS" - LIBS="$LIBS $G_THREAD_LIBS" + # we are not doing the following for now, as this might require glib + # to always be linked with the thread libs on some platforms. + # LIBS="$LIBS $G_THREAD_LIBS" AC_CHECK_FUNCS(localtime_r rand_r) if test "$ac_cv_header_pwd_h" = "yes"; then AC_CHECK_FUNCS(getpwuid_r) diff --git a/glib/gutils.c b/glib/gutils.c index 2dc06a47..698986ba 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -451,10 +451,9 @@ g_get_any_init (void) g_free (buffer); buffer = g_malloc (bufsize); - errno = 0; # ifdef HAVE_GETPWUID_R_POSIX error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw); - error = error < 1 ? errno : error; + error = error < 0 ? errno : error; # else /* !HAVE_GETPWUID_R_POSIX */ pw = getpwuid_r (getuid (), &pwd, buffer, bufsize); error = pw ? 0 : errno; diff --git a/gutils.c b/gutils.c index 2dc06a47..698986ba 100644 --- a/gutils.c +++ b/gutils.c @@ -451,10 +451,9 @@ g_get_any_init (void) g_free (buffer); buffer = g_malloc (bufsize); - errno = 0; # ifdef HAVE_GETPWUID_R_POSIX error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw); - error = error < 1 ? errno : error; + error = error < 0 ? errno : error; # else /* !HAVE_GETPWUID_R_POSIX */ pw = getpwuid_r (getuid (), &pwd, buffer, bufsize); error = pw ? 0 : errno; -- 2.34.1