1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00

login: Assume that _HAVE_UT_* constants are true

Make the GNU version of bits/utmp.h the generic version because
all remaining ports use it (with a sysdeps override for
Linux s390/s390x).
This commit is contained in:
Florian Weimer
2019-08-13 12:09:32 +02:00
parent 9b9670fcd8
commit a33b817f13
13 changed files with 138 additions and 302 deletions

View File

@ -27,26 +27,16 @@
static int
__utmp_equal (const struct utmp *entry, const struct utmp *match)
{
return
(
#if _HAVE_UT_TYPE - 0
(entry->ut_type == INIT_PROCESS
|| entry->ut_type == LOGIN_PROCESS
|| entry->ut_type == USER_PROCESS
|| entry->ut_type == DEAD_PROCESS)
&&
(match->ut_type == INIT_PROCESS
|| match->ut_type == LOGIN_PROCESS
|| match->ut_type == USER_PROCESS
|| match->ut_type == DEAD_PROCESS)
&&
#endif
#if _HAVE_UT_ID - 0
(entry->ut_id[0] && match->ut_id[0]
? strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
: strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0)
#else
strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0
#endif
);
return (entry->ut_type == INIT_PROCESS
|| entry->ut_type == LOGIN_PROCESS
|| entry->ut_type == USER_PROCESS
|| entry->ut_type == DEAD_PROCESS)
&& (match->ut_type == INIT_PROCESS
|| match->ut_type == LOGIN_PROCESS
|| match->ut_type == USER_PROCESS
|| match->ut_type == DEAD_PROCESS)
&& (entry->ut_id[0] && match->ut_id[0]
? strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
: (strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line)
== 0));
}