mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
Changed error handling again, as the error is not always set in errno, it
1999-01-21 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gutils.c (g_get_any_init): Changed error handling again, as the error is not always set in errno, it is the return value on some systems. What an evil world.
This commit is contained in:
parent
30bcb36954
commit
11ea0ea133
@ -1,3 +1,9 @@
|
|||||||
|
1999-01-21 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Changed error handling again, as the
|
||||||
|
error is not always set in errno, it is the return value on some
|
||||||
|
systems. What an evil world.
|
||||||
|
|
||||||
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gstrfuncs.c: Include signal.h only when the signal names will be
|
* gstrfuncs.c: Include signal.h only when the signal names will be
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
1999-01-21 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Changed error handling again, as the
|
||||||
|
error is not always set in errno, it is the return value on some
|
||||||
|
systems. What an evil world.
|
||||||
|
|
||||||
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gstrfuncs.c: Include signal.h only when the signal names will be
|
* gstrfuncs.c: Include signal.h only when the signal names will be
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
1999-01-21 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Changed error handling again, as the
|
||||||
|
error is not always set in errno, it is the return value on some
|
||||||
|
systems. What an evil world.
|
||||||
|
|
||||||
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gstrfuncs.c: Include signal.h only when the signal names will be
|
* gstrfuncs.c: Include signal.h only when the signal names will be
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
1999-01-21 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Changed error handling again, as the
|
||||||
|
error is not always set in errno, it is the return value on some
|
||||||
|
systems. What an evil world.
|
||||||
|
|
||||||
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gstrfuncs.c: Include signal.h only when the signal names will be
|
* gstrfuncs.c: Include signal.h only when the signal names will be
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
1999-01-21 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Changed error handling again, as the
|
||||||
|
error is not always set in errno, it is the return value on some
|
||||||
|
systems. What an evil world.
|
||||||
|
|
||||||
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gstrfuncs.c: Include signal.h only when the signal names will be
|
* gstrfuncs.c: Include signal.h only when the signal names will be
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
1999-01-21 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Changed error handling again, as the
|
||||||
|
error is not always set in errno, it is the return value on some
|
||||||
|
systems. What an evil world.
|
||||||
|
|
||||||
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gstrfuncs.c: Include signal.h only when the signal names will be
|
* gstrfuncs.c: Include signal.h only when the signal names will be
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
1999-01-21 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Changed error handling again, as the
|
||||||
|
error is not always set in errno, it is the return value on some
|
||||||
|
systems. What an evil world.
|
||||||
|
|
||||||
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gstrfuncs.c: Include signal.h only when the signal names will be
|
* gstrfuncs.c: Include signal.h only when the signal names will be
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
1999-01-21 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
|
||||||
|
|
||||||
|
* gutils.c (g_get_any_init): Changed error handling again, as the
|
||||||
|
error is not always set in errno, it is the return value on some
|
||||||
|
systems. What an evil world.
|
||||||
|
|
||||||
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
Thu Jan 21 05:35:20 1999 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* gstrfuncs.c: Include signal.h only when the signal names will be
|
* gstrfuncs.c: Include signal.h only when the signal names will be
|
||||||
|
@ -443,26 +443,30 @@ g_get_any_init (void)
|
|||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
errno = 0;
|
||||||
buffer = g_realloc (buffer, bufsize);
|
buffer = g_realloc (buffer, bufsize);
|
||||||
# ifdef HAVE_GETPWUID_R_POSIX
|
# ifdef HAVE_GETPWUID_R_POSIX
|
||||||
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
|
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
|
||||||
if (error == 0)
|
if (errno == 0) /* The errorcode is in error (might be 0, too) */
|
||||||
break;
|
errno = error;
|
||||||
# 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)
|
|
||||||
break;
|
|
||||||
# endif /* HAVE_GETPWUID_R_POSIX */
|
# endif /* HAVE_GETPWUID_R_POSIX */
|
||||||
error = errno;
|
if (errno == 0)
|
||||||
if (error != ERANGE)
|
{
|
||||||
|
g_assert (pw);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errno != ERANGE)
|
||||||
g_error ("Could not read account information: %s",
|
g_error ("Could not read account information: %s",
|
||||||
g_strerror (error));
|
g_strerror (errno));
|
||||||
bufsize *= 2;
|
bufsize *= 2;
|
||||||
}
|
}
|
||||||
# else /* HAVE_GETPWUID_R */
|
# else /* HAVE_GETPWUID_R */
|
||||||
# if defined(G_THREADS_ENABLED) && defined(__GNUC__)
|
# if defined(G_THREADS_ENABLED) && defined(__GNUC__)
|
||||||
# warning "the `g_get_(user_name|real_name|home_dir|tmp_dir)'"
|
# warning "the `g_get_(user_name|real_name|home_dir|tmp_dir)'"
|
||||||
# warning "functions will not be MT-safe at their first call"
|
# warning "functions will not be MT-safe during their first call"
|
||||||
# warning "because there is no `getpwuid_r' on your system."
|
# warning "because there is no `getpwuid_r' on your system."
|
||||||
# endif
|
# endif
|
||||||
setpwent ();
|
setpwent ();
|
||||||
|
20
gutils.c
20
gutils.c
@ -443,26 +443,30 @@ g_get_any_init (void)
|
|||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
errno = 0;
|
||||||
buffer = g_realloc (buffer, bufsize);
|
buffer = g_realloc (buffer, bufsize);
|
||||||
# ifdef HAVE_GETPWUID_R_POSIX
|
# ifdef HAVE_GETPWUID_R_POSIX
|
||||||
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
|
error = getpwuid_r (getuid (), &pwd, buffer, bufsize, &pw);
|
||||||
if (error == 0)
|
if (errno == 0) /* The errorcode is in error (might be 0, too) */
|
||||||
break;
|
errno = error;
|
||||||
# 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)
|
|
||||||
break;
|
|
||||||
# endif /* HAVE_GETPWUID_R_POSIX */
|
# endif /* HAVE_GETPWUID_R_POSIX */
|
||||||
error = errno;
|
if (errno == 0)
|
||||||
if (error != ERANGE)
|
{
|
||||||
|
g_assert (pw);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errno != ERANGE)
|
||||||
g_error ("Could not read account information: %s",
|
g_error ("Could not read account information: %s",
|
||||||
g_strerror (error));
|
g_strerror (errno));
|
||||||
bufsize *= 2;
|
bufsize *= 2;
|
||||||
}
|
}
|
||||||
# else /* HAVE_GETPWUID_R */
|
# else /* HAVE_GETPWUID_R */
|
||||||
# if defined(G_THREADS_ENABLED) && defined(__GNUC__)
|
# if defined(G_THREADS_ENABLED) && defined(__GNUC__)
|
||||||
# warning "the `g_get_(user_name|real_name|home_dir|tmp_dir)'"
|
# warning "the `g_get_(user_name|real_name|home_dir|tmp_dir)'"
|
||||||
# warning "functions will not be MT-safe at their first call"
|
# warning "functions will not be MT-safe during their first call"
|
||||||
# warning "because there is no `getpwuid_r' on your system."
|
# warning "because there is no `getpwuid_r' on your system."
|
||||||
# endif
|
# endif
|
||||||
setpwent ();
|
setpwent ();
|
||||||
|
Loading…
Reference in New Issue
Block a user