Bug 136119

Summary: ksysguardd segfaults when files are not readable
Product: [Unmaintained] ksysguard Reporter: Andreas Hartmann <andihartmann>
Component: generalAssignee: KSysGuard Developers <ksysguard-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Andreas Hartmann 2006-10-22 09:02:16 UTC
Version:           Unbekannt (using KDE 3.5.5, compiled sources)
Compiler:          Target: i686-pc-linux-gnu
OS:                Linux (i686) release 2.6.17.11-standard

The last patch 595928 (http://websvn.kde.org/branches/KDE/3.5/kdebase/ksysguard/ksysguardd/Linux/logfile.c?rev=595928&r1=465343&r2=595928) of logfile.c crashes ksysguardd, if a logfile doesn't exist (/var/log/kern.log, daemon.log e.g.) or if it isn't readable (/var/log/messages) by the user who starts ksysguardd.


Kind regards,
Andreas Hartmann
Comment 1 Bram Schoenmakers 2006-10-22 13:21:47 UTC
SVN commit 598023 by bram:

Move fclose() into a block where fp does exist.

BUG:136119



 M  +1 -2      logfile.c  


--- branches/KDE/3.5/kdebase/ksysguard/ksysguardd/Linux/logfile.c #598022:598023
@@ -59,9 +59,8 @@
     if ( ( fp = fopen( entry->path, "r" ) ) != NULL ) {
       snprintf( monitor, 1024, "logfiles/%s", entry->name );
       registerMonitor( monitor, "logfile", printLogFile, printLogFileInfo, sm );
+      fclose( fp );
     }
-
-    fclose( fp );
   }
 
   LogFiles = new_ctnr();