]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Report an error if the tail command cannot read the last lines of the log file when...
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Sat, 18 Sep 2010 12:38:19 +0000 (12:38 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Sat, 18 Sep 2010 12:38:19 +0000 (12:38 +0000)
ChangeLog
realtime.c

index a41db3971be94f13edb2157d58d2f4c3c1bccd37..c0a39d38d0339397ba97e61e198676418e26a615 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 SARG ChangeLog
 
-Aug-27-2010 Version 2.3.1
+Sep-02-2010 Version 2.3.1
                - Remove the distinct printf for the alpha architecture as it doesn't work anymore and is not necessary anyway.
                - Don't abort if "onload" or "script" is found in the user agent string.
                - Take the configured locale path into account when installing sarg.
@@ -13,6 +13,7 @@ Aug-27-2010 Version 2.3.1
                - Report an error if the output directory is a subdirectory of the temporary directory.
                - Use a more robust protection against an attack using javascript in the useragent string.
                - Prevent a segfault if the parameter passed to command line option -d is invalid (thanks to ItalianPenguin).
+               - Check for the return code of the tail command to generate the realtime report.
 
 Jun-21-2010 Version 2.3
                - LDAP usertab added. 
index 4f6f456c3fd265a2e6667acaa83002d51f05eca5..9d47fdd4e21b667089c791dff877ed6ffc9b9a69 100755 (executable)
@@ -65,8 +65,13 @@ static void getlog(void)
       exit(EXIT_FAILURE);
    }
 
-   sprintf(cmd,"tail -%d %s",realtime_access_log_lines,AccessLog[0]);
+   sprintf(cmd,"tail -%d \"%s\"",realtime_access_log_lines,AccessLog[0]);
    fp = popen(cmd, "r");
+   if (!fp) {
+      debuga(_("Failed to get the %d trailing lines of %s: %s\n"),realtime_access_log_lines,AccessLog[0],strerror(errno));
+      debuga(_("tail command: %s\n"),cmd);
+      exit(EXIT_FAILURE);
+   }
    while((buf=longline_read(fp,line)) != NULL )
       if (getdata(buf,tmp)<0) {
          debuga(_("Maybe a broken record or garbage was returned by %s\n"),cmd);