mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-10 12:55:48 +01:00
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 :-/.
This commit is contained in:
parent
d5492a983c
commit
96cf177352
@ -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>
|
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* ghash.c:
|
* ghash.c:
|
||||||
|
@ -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>
|
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* ghash.c:
|
* ghash.c:
|
||||||
|
@ -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>
|
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* ghash.c:
|
* ghash.c:
|
||||||
|
@ -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>
|
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* ghash.c:
|
* ghash.c:
|
||||||
|
@ -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>
|
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* ghash.c:
|
* ghash.c:
|
||||||
|
@ -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>
|
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* ghash.c:
|
* ghash.c:
|
||||||
|
@ -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>
|
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* ghash.c:
|
* ghash.c:
|
||||||
|
@ -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>
|
Sun Jan 24 00:36:22 EST 1999 Jeff Garzik <jgarzik@pobox.com>
|
||||||
|
|
||||||
* ghash.c:
|
* ghash.c:
|
||||||
|
@ -450,14 +450,35 @@ g_get_any_init (void)
|
|||||||
buffer = g_malloc (bufsize);
|
buffer = g_malloc (bufsize);
|
||||||
|
|
||||||
# ifdef HAVE_GETPWUID_R_POSIX
|
# 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);
|
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
|
||||||
if (!error)
|
|
||||||
|
if (error == 0)
|
||||||
goto pw_out;
|
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 */
|
# else /* !HAVE_GETPWUID_R_POSIX */
|
||||||
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
|
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
|
||||||
if (pw == NULL)
|
if (pw != NULL)
|
||||||
goto pw_out;
|
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;
|
error = errno;
|
||||||
# endif /* !HAVE_GETPWUID_R_POSIX */
|
# endif /* !HAVE_GETPWUID_R_POSIX */
|
||||||
|
|
||||||
|
27
gutils.c
27
gutils.c
@ -450,14 +450,35 @@ g_get_any_init (void)
|
|||||||
buffer = g_malloc (bufsize);
|
buffer = g_malloc (bufsize);
|
||||||
|
|
||||||
# ifdef HAVE_GETPWUID_R_POSIX
|
# 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);
|
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
|
||||||
if (!error)
|
|
||||||
|
if (error == 0)
|
||||||
goto pw_out;
|
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 */
|
# else /* !HAVE_GETPWUID_R_POSIX */
|
||||||
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
|
pw = getpwuid_r (getuid (), &pwd, buffer, bufsize);
|
||||||
if (pw == NULL)
|
if (pw != NULL)
|
||||||
goto pw_out;
|
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;
|
error = errno;
|
||||||
# endif /* !HAVE_GETPWUID_R_POSIX */
|
# endif /* !HAVE_GETPWUID_R_POSIX */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user