summarylogtreecommitdiffstats
path: root/events-log-fix.patch
blob: c8d96766b4948b2fefc338f192093eb211480f70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--- firestarter-1.0.3.orig/firestarter.schemas.in	2005-01-29 20:32:09.000000000 +0800
+++ firestarter-1.0.3/firestarter.schemas.in	2006-12-20 20:18:02.000000000 +0800
@@ -82,7 +82,7 @@
       <applyto>/apps/firestarter/client/system_log</applyto>
       <owner>Firestarter</owner>
       <type>string</type>
-      <default>/var/log/messages</default>
+      <default>/var/log/iptables.log</default>
       <locale name="C">
         <short>The system log file</short>
         <long>The location of the file the system logging daemon writes to.</long>
--- firestarter-1.0.3.orig/src/logread.c	2005-01-29 20:32:08.000000000 +0800
+++ firestarter-1.0.3/src/logread.c	2008-03-11 21:24:54.000000000 +0800
@@ -189,6 +194,10 @@
  */
 void
 open_logfile (char *logpath) {
+	/* Check if logpath isn't NULL before proceeding to avoid libgnomevfs-CRITICAL errors */
+	if (logpath == NULL)
+		return;
+
 	GnomeVFSAsyncHandle *handle;
 
 	gnome_vfs_async_open(&handle, logpath, GNOME_VFS_OPEN_READ, GNOME_VFS_PRIORITY_DEFAULT,
--- firestarter-1.0.3.orig/src/util.c	2005-01-29 20:32:08.000000000 +0800
+++ firestarter-1.0.3/src/util.c	2006-12-20 20:31:06.000000000 +0800
@@ -24,6 +24,7 @@
 #include "util.h"
 #include "hitview.h"
 #include "preferences.h"
+#include "logread.h"
 
 extern int h_errno;
 
@@ -121,13 +122,18 @@
 		/* User has specified the log file location */
 		path = preferences_get_string (PREFS_SYSLOG_FILE);
 
-		if (path && g_file_test (path, G_FILE_TEST_EXISTS)) {
+		if (path && g_file_test (path, G_FILE_TEST_EXISTS) && parse_log_line (path)->time != "") {
 			return path;
-		} else { /* Try to guess some default syslog location */
-			if (g_file_test ("/var/log/messages", G_FILE_TEST_EXISTS))
-				path = g_strdup ("/var/log/messages");
-			else if (g_file_test ("/var/log/kernel", G_FILE_TEST_EXISTS))
+		} else { /* Guess default kernel messages log path: syslog-ng first, then sysklogd and metalog */
+			if (g_file_test ("/var/log/iptables.log", G_FILE_TEST_EXISTS) && parse_log_line ("/var/log/iptables.log")->time != "")
+				path = g_strdup ("/var/log/iptables.log");
+			else if (g_file_test ("/var/log/kernel", G_FILE_TEST_EXISTS) && parse_log_line ("/var/log/kernel")->time != "")
 				path = g_strdup ("/var/log/kernel");
+			/* Let's try these just in case */
+			else if (g_file_test ("/var/log/messages.log", G_FILE_TEST_EXISTS) && parse_log_line ("/var/log/messages.log")->time != "")
+				path = g_strdup ("/var/log/messages.log");
+			else if (g_file_test ("/var/log/messages", G_FILE_TEST_EXISTS) && parse_log_line ("/var/log/messages")->time != "")
+				path = g_strdup ("/var/log/messages");
 			else
 				path = NULL;
 		}