diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2009-06-20 22:37:41 +0200 |
---|---|---|
committer | Anton Arapov <aarapov@redhat.com> | 2009-06-20 22:37:41 +0200 |
commit | 7035b97b4b19360d46c3190e698ac875ff99af37 (patch) | |
tree | ad1aa01f3c91923fd14119d83d0045c357d94d49 /lib/Plugins/KerneloopsScanner.cpp | |
parent | 13c4d2db332ba6443a2a762c3a7d0a588f0e1f04 (diff) | |
download | abrt-7035b97b4b19360d46c3190e698ac875ff99af37.tar.gz abrt-7035b97b4b19360d46c3190e698ac875ff99af37.tar.xz abrt-7035b97b4b19360d46c3190e698ac875ff99af37.zip |
Really limit max size of log to read to 32 MB
Because of MAX/MIN confusion, the buffer size was always at least 32 MB,
instead of at most 32 MB as intended.
Diffstat (limited to 'lib/Plugins/KerneloopsScanner.cpp')
-rw-r--r-- | lib/Plugins/KerneloopsScanner.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Plugins/KerneloopsScanner.cpp b/lib/Plugins/KerneloopsScanner.cpp index 05e2a18..e95f259 100644 --- a/lib/Plugins/KerneloopsScanner.cpp +++ b/lib/Plugins/KerneloopsScanner.cpp @@ -12,7 +12,7 @@ #include <asm/unistd.h> -#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#define MIN(A,B) ((A) < (B) ? (A) : (B)) #define FILENAME_KERNELOOPS "kerneloops" void CKerneloopsScanner::WriteSysLog(int m_nCount) @@ -118,13 +118,13 @@ void CKerneloopsScanner::ScanSysLogFile(const char *filename, int issyslog) * to /var/log/messages before we read it in... we try to * deal with it by reading at most 1023 bytes extra. If there's * more than that.. any oops will be in dmesg anyway. - * Do not try to allocate an absurt amount of memory; ignore + * Do not try to allocate an absurd amount of memory; ignore * older log messages because they are unlikely to have * sufficiently recent data to be useful. 32MB is more * than enough; it's not worth looping through more log * if the log is larger than that. */ - buflen = MAX(statb.st_size+1024, 32*1024*1024); + buflen = MIN(statb.st_size+1024, 32*1024*1024); buffer = (char*)calloc(buflen, 1); assert(buffer != NULL); |