Make dtlogin compile on OpenBSD.
authorPascal Stumpf <Pascal.Stumpf@cubes.de>
Sat, 11 Aug 2012 11:49:07 +0000 (13:49 +0200)
committerJon Trulson <jon@radscan.com>
Sun, 12 Aug 2012 01:51:35 +0000 (19:51 -0600)
Most importantly, we *cannot* do the utmp stuff this code is attempting.
It is SysV-specific.

cde/programs/dtlogin/account.c
cde/programs/dtlogin/dm.c
cde/programs/dtlogin/session.c
cde/programs/dtlogin/util.c

index d5047a3885c6da648c4fc31cc5a163281598d633..e14389d43cad1603fc0dfd776c1503da46031d5a 100644 (file)
@@ -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);
 }
 
index 717b0435e031bf60798d45ade3b81d53993009d6..136d0bda87c5548d8116ddb12b60863b825add5c 100644 (file)
@@ -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;
 }
 
index 92fa5d8500247b6d538963cf2e31cb144f51d43f..a1fbaa6a57e899768766938a1036560fda4a6c1e 100644 (file)
@@ -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
 
index c93d29bf00c80677457c78be14a232ae2d069b15..accb0ff69f5e2462e82cf763ac700caa4445059b 100644 (file)
@@ -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;
             
     /*