Hi all,

Attached are some tiny cleanup fixes for sessreg.

Best regards,
-- 
 Ed Schouten <[email protected]>
 WWW: http://80386.nl/
From fdc4ae696e4da1db6c93df85f68883f78793be44 Mon Sep 17 00:00:00 2001
From: Ed Schouten <[email protected]>
Date: Sat, 15 Sep 2012 20:11:20 +0200
Subject: [PATCH 1/3] Place NetBSD specific #defines in the proper place.

For all the other databases (utmp, wtmp, lastlog) we already do it in
sessreg.h. There's no reason why we should place the utmpx specific ones
in sessreg.c.

Signed-off-by: Ed Schouten <[email protected]>
---
 sessreg.c | 6 ------
 sessreg.h | 7 +++++++
 2 Dateien geändert, 7 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)

diff --git a/sessreg.c b/sessreg.c
index 164cda8..6c559f5 100644
--- a/sessreg.c
+++ b/sessreg.c
@@ -99,12 +99,6 @@ static const char *wtmpx_file = NULL;
 static const char *utmpx_file = NULL;
 #endif
 #endif
-#ifndef WTMPX_FILE
-#define WTMPX_FILE	_PATH_WTMPX
-#endif
-#ifndef UTMPX_FILE
-#define UTMPX_FILE	_PATH_UTMPX
-#endif
 
 static int utmp_none, wtmp_none;
 /*
diff --git a/sessreg.h b/sessreg.h
index a5e7f83..0a0a209 100644
--- a/sessreg.h
+++ b/sessreg.h
@@ -106,3 +106,10 @@
 #ifndef TTYS_FILE
 # define TTYS_FILE	"/etc/ttys"
 #endif
+
+#ifndef WTMPX_FILE
+# define WTMPX_FILE	_PATH_WTMPX
+#endif
+#ifndef UTMPX_FILE
+# define UTMPX_FILE	_PATH_UTMPX
+#endif
-- 
1.7.11.4

From a48ec96b717e915af7e5da26344a2db7aa894142 Mon Sep 17 00:00:00 2001
From: Ed Schouten <[email protected]>
Date: Sat, 15 Sep 2012 20:26:57 +0200
Subject: [PATCH 2/3] Make the `line' variable local to main().

It is only used within main(). This prevents a compilation failure when
building with -Wshadow.

Signed-off-by: Ed Schouten <[email protected]>
---
 sessreg.c | 2 +-
 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/sessreg.c b/sessreg.c
index 6c559f5..cc15869 100644
--- a/sessreg.c
+++ b/sessreg.c
@@ -90,7 +90,6 @@ static void set_utmpx (struct utmpx *u, const char *line, const char *user,
 
 static int wflag, uflag, lflag;
 static const char *wtmp_file, *utmp_file;
-static char *line;
 #ifdef USE_UTMPX
 #ifdef HAVE_UPDWTMPX
 static const char *wtmpx_file = NULL;
@@ -195,6 +194,7 @@ main (int argc, char **argv)
 #ifdef USE_UTMPX
 	struct utmpx	utmpx_entry;
 #endif
+	char *		line = NULL;
 
 	program_name = argv[0];
 	while (*++argv && **argv == '-') {
-- 
1.7.11.4

From 7526cee4e3dacc8977ce37d018b4e0f3a6443df7 Mon Sep 17 00:00:00 2001
From: Ed Schouten <[email protected]>
Date: Sat, 15 Sep 2012 20:27:57 +0200
Subject: [PATCH 3/3] Remove dubious code.

The NO_UTMP definition is set on non-FreeBSD, non-OpenBSD, BSD-based
systems. When looking at the commonly used BSD-based operating systems,
they either use utmpx, or I can't think of a reason why the utmp code
wouldn't work.

If it turns out some obscure operating system breaks because of this
change, we should replace this by something more accurate, such as an
Autoconf check or an #ifdef specific to that operating system.

Signed-off-by: Ed Schouten <[email protected]>
---
 sessreg.c | 4 ----
 sessreg.h | 7 -------
 2 Dateien geändert, 11 Zeilen entfernt(-)

diff --git a/sessreg.c b/sessreg.c
index cc15869..43291eb 100644
--- a/sessreg.c
+++ b/sessreg.c
@@ -258,16 +258,12 @@ main (int argc, char **argv)
 		wtmpx_file = WTMPX_FILE;
 #endif
 	}
-#ifndef NO_UTMP
 	if (!uflag) {
 		utmp_file = UTMP_FILE;
 #if defined(USE_UTMPX) && defined(HAVE_UTMPXNAME)
 		utmpx_file = UTMPX_FILE;
 #endif
 	}
-#else
-	utmp_none = 1;
-#endif
 #ifdef USE_LASTLOG
 	if (!Lflag)
 		llog_file = LLOG_FILE;
diff --git a/sessreg.h b/sessreg.h
index 0a0a209..71e93f1 100644
--- a/sessreg.h
+++ b/sessreg.h
@@ -75,13 +75,6 @@
 # define USE_LASTLOG
 #endif
 
-#ifdef CSRG_BASED
-#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
-/* *BSD doesn't like a ':0' type entry in utmp */
-#define NO_UTMP
-#endif
-#endif
-
 #ifndef WTMP_FILE
 # ifdef _PATH_WTMP
 #  define WTMP_FILE	_PATH_WTMP
-- 
1.7.11.4

Attachment: pgpmIYWxCbvsl.pgp
Description: PGP signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to