[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/kdm
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2007-12-14 15:33:52
Message-ID: 1197646432.652798.18879.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 748464 by ossi:

use updwtmp{,x}() if available


 M  +1 -0      ConfigureChecks.cmake  
 M  +12 -2     backend/sessreg.c  
 M  +3 -0      config-kdm.h.cmake  


--- trunk/KDE/kdebase/workspace/kdm/ConfigureChecks.cmake #748463:748464
@@ -82,6 +82,7 @@
 		set(BSD_UTMP 1)
 	endif (NOT have_getutent)
 endif (NOT HAVE_UTMPX)
+check_function_exists(updwtmp HAVE_UPDWTMP)
 
 check_function_exists(arc4random HAVE_ARC4RANDOM)
 if (NOT HAVE_ARC4RANDOM)
--- trunk/KDE/kdebase/workspace/kdm/backend/sessreg.c #748463:748464
@@ -99,7 +99,7 @@
 sessreg( struct display *d, int pid, const char *user, int uid )
 {
 	const char *dot, *colon;
-	int left, clen;
+	int left, clen, c;
 #ifdef BSD_UTMP
 	FILE *ttys;
 	int utmp, slot, freeslot;
@@ -107,7 +107,9 @@
 #else
 	unsigned crc, i;
 #endif
-	int wtmp, c;
+#ifndef HAVE_UPDWTMP
+	int wtmp;
+#endif
 #ifndef NO_LASTLOG
 	int llog;
 	struct LASTLOG ll;
@@ -257,6 +259,13 @@
 # endif
 #endif
 
+#ifdef HAVE_UPDWTMP
+# ifdef HAVE_UTMPX
+	updwtmpx( WTMP_FILE, &ut_ent );
+# else
+	updwtmp( WTMP_FILE, &ut_ent );
+# endif
+#else
 	if ((wtmp = open( WTMP_FILE, O_WRONLY|O_APPEND )) < 0)
 		debug( "cannot open wtmp file " WTMP_FILE ": %m\n" );
 	else {
@@ -264,6 +273,7 @@
 			logError( "Cannot write wtmp file " WTMP_FILE ": %m\n" );
 		close( wtmp );
 	}
+#endif
 
 #ifndef NO_LASTLOG
 	if (pid) {
--- trunk/KDE/kdebase/workspace/kdm/config-kdm.h.cmake #748463:748464
@@ -66,6 +66,9 @@
 /* Define if the system has no getutent */
 #cmakedefine BSD_UTMP 1
 
+/* Define if the system has the updwtmp function */
+#cmakedefine HAVE_UPDWTMP 1
+
 /* Define if the system uses extended utmp */
 #cmakedefine HAVE_UTMPX 1
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic