From 7c3a972d322eef49d4aff2b9187567cfccf29282 Mon Sep 17 00:00:00 2001 From: Pascal Stumpf Date: Sat, 11 Aug 2012 13:49:07 +0200 Subject: [PATCH] Make dtlogin compile on OpenBSD. Most importantly, we *cannot* do the utmp stuff this code is attempting. It is SysV-specific. --- cde/programs/dtlogin/account.c | 4 ++++ cde/programs/dtlogin/dm.c | 16 +++++++++++++++- cde/programs/dtlogin/session.c | 2 +- cde/programs/dtlogin/util.c | 3 ++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/cde/programs/dtlogin/account.c b/cde/programs/dtlogin/account.c index d5047a38..e14389d4 100644 --- a/cde/programs/dtlogin/account.c +++ b/cde/programs/dtlogin/account.c @@ -138,6 +138,7 @@ Account( struct display *d, char *user, char *line, pid_t pid, #endif /* NeedWidePrototypes */ waitType exitcode ) { +#if !defined(CSRG_BASED) /* we cannot do this on BSD ... */ struct utmp utmp; /* local struct for new entry */ struct utmp *u; /* pointer to entry in utmp file */ int fd; @@ -348,6 +349,7 @@ Account( struct display *d, char *user, char *line, pid_t pid, #endif #endif /* !sun */ +#endif /* !CSRG_BASED */ } @@ -369,6 +371,7 @@ UtmpIdOpen( char *utmpId ) struct utmp *u; /* pointer to entry in utmp file */ int status = 1; /* return code */ +#if !defined(CSRG_BASED) while ( (u = getutent()) != NULL ) { if ( (strncmp(u->ut_id, utmpId, 4) == 0 ) && @@ -380,6 +383,7 @@ UtmpIdOpen( char *utmpId ) } endutent(); +#endif return (status); } diff --git a/cde/programs/dtlogin/dm.c b/cde/programs/dtlogin/dm.c index 717b0435..136d0bda 100644 --- a/cde/programs/dtlogin/dm.c +++ b/cde/programs/dtlogin/dm.c @@ -515,7 +515,7 @@ StopAll( int arg ) int ChildReady = 0; -#if !defined(SYSV) || defined(hpux) || defined(_AIX) || defined(__uxp__) || defined (__osf__) || defined(linux) +#if !defined(SYSV) || defined(hpux) || defined(_AIX) || defined(__uxp__) || defined (__osf__) || defined(linux) || defined(CSRG_BASED) static SIGVAL ChildNotify( int arg ) { @@ -599,7 +599,9 @@ ProcessChildDeath( int pid, waitType status ) * do process accounting... */ +#if !defined(CSRG_BASED) Account(d, NULL, NULL, pid, DEAD_PROCESS, status); +#endif /* @@ -732,7 +734,9 @@ ProcessChildDeath( int pid, waitType status ) * do process accounting... */ +#if !defined(CSRG_BASED) Account(d, NULL, NULL, pid, DEAD_PROCESS, status); +#endif switch (d->status) { @@ -1030,6 +1034,7 @@ StartDisplay( * are already in use... */ +#if !defined(CSRG_BASED) if (d->utmpId == NULL) { int i; char *p, *q; @@ -1061,6 +1066,7 @@ StartDisplay( } #endif } +#endif } if (NULL == d->authFile) @@ -1150,7 +1156,9 @@ StartDisplay( } } #endif +#if !defined(CSRG_BASED) Account(d, "LOGIN", line, getpid(), LOGIN_PROCESS, status); +#endif } if (!WaitForServer (d)) @@ -1244,7 +1252,9 @@ StopDisplay( struct display *d ) else if ((d->displayType.location == Local) || !dt_shutdown ) { /* don't remove the console */ +#if !defined(CSRG_BASED) Account(d, NULL, NULL, 0, DEAD_PROCESS, status); +#endif RemoveDisplay (d); } } @@ -1546,7 +1556,9 @@ StartGetty( struct display *d ) /* * do process accounting... */ +#if !defined(CSRG_BASED) Account(d, "LOGIN", NULL, getpid(), LOGIN_PROCESS, status); +#endif #ifdef _AIX @@ -1723,6 +1735,7 @@ GettyRunning( struct display *d ) Debug("Checking for a getty on line %s.\n", utmp.ut_line); +#if !defined(CSRG_BASED) setutent(); rvalue = FALSE; @@ -1760,6 +1773,7 @@ GettyRunning( struct display *d ) } endutent(); +#endif /* !CSRG_BASED */ return rvalue; } diff --git a/cde/programs/dtlogin/session.c b/cde/programs/dtlogin/session.c index 92fa5d85..a1fbaa6a 100644 --- a/cde/programs/dtlogin/session.c +++ b/cde/programs/dtlogin/session.c @@ -1290,7 +1290,7 @@ StartClient( struct verify_info *verify, struct display *d, int *pidp ) } #endif -#ifndef sun +#if !defined(sun) && !defined(CSRG_BASED) Account(d, user, NULL, getpid(), USER_PROCESS, status); #endif diff --git a/cde/programs/dtlogin/util.c b/cde/programs/dtlogin/util.c index c93d29bf..accb0ff6 100644 --- a/cde/programs/dtlogin/util.c +++ b/cde/programs/dtlogin/util.c @@ -679,7 +679,8 @@ static int MatchesFileSuffix(char *filename, char *suffix) { int retval = 0; -#if defined(_AIX) || defined(SVR4) || defined (__osf__) || defined(linux) +#if defined(_AIX) || defined(SVR4) || defined (__osf__) || defined(linux) || \ + defined(CSRG_BASED) char *pch; /* -- 2.25.1