diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-15 08:23:47 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-05-15 08:23:47 +0000 |
| commit | 90895bbcb4e568111ebf62b6b48703ca333f9dc9 (patch) | |
| tree | 02b191a497cb966520d6298a0d7cb8e399d15aa7 /src/zabbix_server/housekeeper | |
| parent | be000752b77f89f4434ab6feac9b8ea2d8ef46cd (diff) | |
| download | zabbix-90895bbcb4e568111ebf62b6b48703ca333f9dc9.tar.gz zabbix-90895bbcb4e568111ebf62b6b48703ca333f9dc9.tar.xz zabbix-90895bbcb4e568111ebf62b6b48703ca333f9dc9.zip | |
- fixed zabbix server crash after SQL request reading (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2837 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/zabbix_server/housekeeper')
| -rw-r--r-- | src/zabbix_server/housekeeper/housekeeper.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/zabbix_server/housekeeper/housekeeper.c b/src/zabbix_server/housekeeper/housekeeper.c index e22c675a..4f86eadc 100644 --- a/src/zabbix_server/housekeeper/housekeeper.c +++ b/src/zabbix_server/housekeeper/housekeeper.c @@ -142,7 +142,12 @@ static int housekeeping_alerts(int now) row=DBfetch(result); - if(row) + if(!row || DBis_null(row[0])==SUCCEED) + { + zabbix_log( LOG_LEVEL_ERR, "No records in table 'config'."); + res = FAIL; + } + else { alert_history=atoi(row[0]); @@ -150,11 +155,6 @@ static int housekeeping_alerts(int now) DBexecute(sql); zabbix_log( LOG_LEVEL_DEBUG, "Deleted [%ld] records from table [alerts]", DBaffected_rows()); } - else - { - zabbix_log( LOG_LEVEL_ERR, "No records in table 'config'."); - res = FAIL; - } DBfree_result(result); return res; @@ -177,7 +177,12 @@ static int housekeeping_alarms(int now) result = DBselect(sql); row1=DBfetch(result); - if(row1) + if(!row1 || DBis_null(row1[0])==SUCCEED) + { + zabbix_log( LOG_LEVEL_ERR, "No records in table 'config'."); + res = FAIL; + } + else { alarm_history=atoi(row1[0]); @@ -197,11 +202,6 @@ static int housekeeping_alarms(int now) zabbix_log( LOG_LEVEL_DEBUG, "Deleted [%ld] records from table [alarms]", DBaffected_rows()); } - else - { - zabbix_log( LOG_LEVEL_ERR, "No records in table 'config'."); - res = FAIL; - } DBfree_result(result); return res; |
