summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaja R Harinath <harinath@src.gnome.org>1999-01-24 07:10:18 +0000
committerRaja R Harinath <harinath@src.gnome.org>1999-01-24 07:10:18 +0000
commit96cf177352940831b989301681c1483a52a319d5 (patch)
tree1d5df1fe8ed4509c2e1a047a6412a60fca06c3bd
parentd5492a983cfa048658af8b03f833ddb3c0cf355e (diff)
Hopefully got the error handling for `getpwuid_r' right. (g_get_any_init)
* gutils.c (g_get_any_init) [HAVE_GETPWUID_R && HAVE_GETPWUID_R_POSIX]: Hopefully got the error handling for `getpwuid_r' right. (g_get_any_init) [HAVE_GETPWUID_R && !HAVE_GETPWUID_R_POSIX]: Fix typo (change `pw == NULL' to `pw != NULL'). Please let this be right :-/.
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-2-08
-rw-r--r--ChangeLog.pre-2-108
-rw-r--r--ChangeLog.pre-2-128
-rw-r--r--ChangeLog.pre-2-28
-rw-r--r--ChangeLog.pre-2-48
-rw-r--r--ChangeLog.pre-2-68
-rw-r--r--ChangeLog.pre-2-88
-rw-r--r--glib/gutils.c27
-rw-r--r--gutils.c27
10 files changed, 112 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index afe3eea68..abce29135 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+1999-01-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gutils.c
+ (g_get_any_init) [HAVE_GETPWUID_R && HAVE_GETPWUID_R_POSIX]:
+ Hopefully got the error handling for `getpwuid_r' right.
+ (g_get_any_init) [HAVE_GETPWUID_R && !HAVE_GETPWUID_R_POSIX]:
+ Fix typo (change `pw == NULL' to `pw != NULL').
+
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* ghash.c:
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index afe3eea68..abce29135 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,11 @@
+1999-01-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gutils.c
+ (g_get_any_init) [HAVE_GETPWUID_R && HAVE_GETPWUID_R_POSIX]:
+ Hopefully got the error handling for `getpwuid_r' right.
+ (g_get_any_init) [HAVE_GETPWUID_R && !HAVE_GETPWUID_R_POSIX]:
+ Fix typo (change `pw == NULL' to `pw != NULL').
+
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* ghash.c:
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index afe3eea68..abce29135 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,11 @@
+1999-01-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gutils.c
+ (g_get_any_init) [HAVE_GETPWUID_R && HAVE_GETPWUID_R_POSIX]:
+ Hopefully got the error handling for `getpwuid_r' right.
+ (g_get_any_init) [HAVE_GETPWUID_R && !HAVE_GETPWUID_R_POSIX]:
+ Fix typo (change `pw == NULL' to `pw != NULL').
+
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* ghash.c:
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index afe3eea68..abce29135 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,11 @@
+1999-01-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gutils.c
+ (g_get_any_init) [HAVE_GETPWUID_R && HAVE_GETPWUID_R_POSIX]:
+ Hopefully got the error handling for `getpwuid_r' right.
+ (g_get_any_init) [HAVE_GETPWUID_R && !HAVE_GETPWUID_R_POSIX]:
+ Fix typo (change `pw == NULL' to `pw != NULL').
+
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* ghash.c:
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index afe3eea68..abce29135 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,11 @@
+1999-01-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gutils.c
+ (g_get_any_init) [HAVE_GETPWUID_R && HAVE_GETPWUID_R_POSIX]:
+ Hopefully got the error handling for `getpwuid_r' right.
+ (g_get_any_init) [HAVE_GETPWUID_R && !HAVE_GETPWUID_R_POSIX]:
+ Fix typo (change `pw == NULL' to `pw != NULL').
+
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* ghash.c:
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index afe3eea68..abce29135 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,11 @@
+1999-01-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gutils.c
+ (g_get_any_init) [HAVE_GETPWUID_R && HAVE_GETPWUID_R_POSIX]:
+ Hopefully got the error handling for `getpwuid_r' right.
+ (g_get_any_init) [HAVE_GETPWUID_R && !HAVE_GETPWUID_R_POSIX]:
+ Fix typo (change `pw == NULL' to `pw != NULL').
+
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* ghash.c:
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index afe3eea68..abce29135 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,11 @@
+1999-01-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gutils.c
+ (g_get_any_init) [HAVE_GETPWUID_R && HAVE_GETPWUID_R_POSIX]:
+ Hopefully got the error handling for `getpwuid_r' right.
+ (g_get_any_init) [HAVE_GETPWUID_R && !HAVE_GETPWUID_R_POSIX]:
+ Fix typo (change `pw == NULL' to `pw != NULL').
+
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* ghash.c:
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index afe3eea68..abce29135 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,11 @@
+1999-01-24 Raja R Harinath <harinath@cs.umn.edu>
+
+ * gutils.c
+ (g_get_any_init) [HAVE_GETPWUID_R && HAVE_GETPWUID_R_POSIX]:
+ Hopefully got the error handling for `getpwuid_r' right.
+ (g_get_any_init) [HAVE_GETPWUID_R && !HAVE_GETPWUID_R_POSIX]:
+ Fix typo (change `pw == NULL' to `pw != NULL').
+
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
* ghash.c:
diff --git a/glib/gutils.c b/glib/gutils.c
index b9d56899c..da4b3d1d5 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -450,14 +450,35 @@ g_get_any_init (void)
buffer = g_malloc (bufsize);
# ifdef HAVE_GETPWUID_R_POSIX
+ /* There appears to be some confusion about what the return
+ value should be, and whether errno is set or not.
+ So, we are careful about it. */
+ errno = 0;
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
- if (!error)
+
+ if (error == 0)
goto pw_out;
- error = errno;
+
+ /* Some kind of error.
+
+ SUSv2 says returned value is an error code; says nothing
+ about `errno'. GNU Libc says some non-null (sic) value and
+ errno is set. Either way, this code path is chosen.
+
+ If `errno' isn't changed, the return value contains the
+ error code (like ERANGE).
+
+ If `errno' is changed, then it must be right, irrespective
+ of whether the return value follows SUSv2 or not. */
+ if (errno != 0)
+ error = errno;
+
# else /* !HAVE_GETPWUID_R_POSIX */
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
- if (pw == NULL)
+ if (pw != NULL)
goto pw_out;
+ /* If it got here, there is an error. The `uid' should be
+ valid, so there must be something else wrong. */
error = errno;
# endif /* !HAVE_GETPWUID_R_POSIX */
diff --git a/gutils.c b/gutils.c
index b9d56899c..da4b3d1d5 100644
--- a/gutils.c
+++ b/gutils.c
@@ -450,14 +450,35 @@ g_get_any_init (void)
buffer = g_malloc (bufsize);
# ifdef HAVE_GETPWUID_R_POSIX
+ /* There appears to be some confusion about what the return
+ value should be, and whether errno is set or not.
+ So, we are careful about it. */
+ errno = 0;
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
- if (!error)
+
+ if (error == 0)
goto pw_out;
- error = errno;
+
+ /* Some kind of error.
+
+ SUSv2 says returned value is an error code; says nothing
+ about `errno'. GNU Libc says some non-null (sic) value and
+ errno is set. Either way, this code path is chosen.
+
+ If `errno' isn't changed, the return value contains the
+ error code (like ERANGE).
+
+ If `errno' is changed, then it must be right, irrespective
+ of whether the return value follows SUSv2 or not. */
+ if (errno != 0)
+ error = errno;
+
# else /* !HAVE_GETPWUID_R_POSIX */
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
- if (pw == NULL)
+ if (pw != NULL)
goto pw_out;
+ /* If it got here, there is an error. The `uid' should be
+ valid, so there must be something else wrong. */
error = errno;
# endif /* !HAVE_GETPWUID_R_POSIX */