X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Freadutmp.c;h=f39535299404e5702055be83f523a418150fd8da;hb=3c3d25cda666d07b6b0d3c3f998e3e652d79cf2d;hp=f2fd7f9336f16fd045d819a1a1e0df492a07837a;hpb=e62fae456efa63e28b029f9b7e3c728c191e56a4;p=gnulib.git diff --git a/lib/readutmp.c b/lib/readutmp.c index f2fd7f933..f39535299 100644 --- a/lib/readutmp.c +++ b/lib/readutmp.c @@ -66,13 +66,16 @@ read_utmp (const char *filename, int *n_entries, STRUCT_UTMP **utmp_buf) STRUCT_UTMP *u; STRUCT_UTMP *utmp = NULL; - if (utmpname (filename)) - return 1; + /* Ignore the return value for now. + Solaris' utmpname returns 1 upon success -- which is contrary + to what the GNU libc version does. In addition, older GNU libc + versions are actually void. */ + UTMP_NAME_FUNCTION (filename); - setutent (); + SET_UTMP_ENT (); n_read = 0; - while ((u = getutent ()) != NULL) + while ((u = GET_UTMP_ENT ()) != NULL) { ++n_read; utmp = (STRUCT_UTMP *) realloc (utmp, n_read * sizeof (STRUCT_UTMP)); @@ -81,7 +84,7 @@ read_utmp (const char *filename, int *n_entries, STRUCT_UTMP **utmp_buf) utmp[n_read - 1] = *u; } - endutent (); + END_UTMP_ENT (); *n_entries = n_read; *utmp_buf = utmp;