1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 11:42:21 +00:00

dtlogin: add utmpx support to UtmpIdOpen.

This commit is contained in:
Liang Chang 2021-01-29 23:59:22 -05:00 committed by Jon Trulson
parent bf9c9c2299
commit 7d8dea61b2

View file

@ -406,11 +406,18 @@ Account( struct display *d, char *user, char *line, pid_t pid,
int int
UtmpIdOpen( char *utmpId ) UtmpIdOpen( char *utmpId )
{ {
struct utmp *u; /* pointer to entry in utmp file */
int status = 1; /* return code */ int status = 1; /* return code */
#if !defined(CSRG_BASED) #if !defined(CSRG_BASED) || defined(HAS_PAM_LIBRARY)
#ifdef HAS_PAM_LIBRARY
struct utmpx *u; /* pointer to entry in utmp file */
while ( (u = getutxent()) != NULL ) {
#else
struct utmp *u; /* pointer to entry in utmp file */
while ( (u = getutent()) != NULL ) { while ( (u = getutent()) != NULL ) {
#endif
if ( (strncmp(u->ut_id, utmpId, 4) == 0 ) && if ( (strncmp(u->ut_id, utmpId, 4) == 0 ) &&
u->ut_type != DEAD_PROCESS ) { u->ut_type != DEAD_PROCESS ) {
@ -420,7 +427,11 @@ UtmpIdOpen( char *utmpId )
} }
} }
#ifdef HAS_PAM_LIBRARY
endutxent();
#else
endutent(); endutent();
#endif
#endif #endif
return (status); return (status);
} }