[Pkg-nagios-changes] nagios/patches 00list, 1.9,
1.10 14_xdata_check-fulldisks.dpatch, NONE, 1.1
seanius at haydn.debian.org
seanius at haydn.debian.org
Fri Dec 2 07:51:43 UTC 2005
Update of /cvsroot/pkg-nagios/nagios/patches
In directory haydn:/org/alioth.debian.org/chroot/home/users/seanius/tmp/cvs-serv16243/patches
Modified Files:
00list
Added Files:
14_xdata_check-fulldisks.dpatch
Log Message:
status.log write checking
Index: 00list
===================================================================
RCS file: /cvsroot/pkg-nagios/nagios/patches/00list,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- 00list 29 Aug 2005 17:15:36 -0000 1.9
+++ 00list 2 Dec 2005 07:51:39 -0000 1.10
@@ -13,3 +13,4 @@
10000_no-password-disclosure.dpatch
12_xrddb.c-errorhandling.dpatch
13_config.h.in-traceroute_hardcoded.dpatch
+14_xdata_check-fulldisks.dpatch
--- NEW FILE: 14_xdata_check-fulldisks.dpatch ---
#! /bin/sh /usr/share/dpatch/dpatch-run
## 14_xdata_check-fulldisks.dpatch by <seanius at debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: perform error checks on writes to the status log
## DP: backported by sean finney from the 2.0 cvs tree.
@DPATCH@
diff -urNad sid~/xdata/xsddefault.c sid/xdata/xsddefault.c
--- sid~/xdata/xsddefault.c 2002-02-26 05:04:11.000000000 +0100
+++ sid/xdata/xsddefault.c 2005-12-02 08:44:38.000000000 +0100
@@ -208,16 +208,26 @@
/* start aggregated dump */
int xsddefault_begin_aggregated_dump(void){
char buffer[MAX_INPUT_BUFFER];
+ char temp_buffer[MAX_INPUT_BUFFER];
/* open a safe temp file for output */
snprintf(xsddefault_aggregate_temp_file,sizeof(xsddefault_aggregate_temp_file)-1,"%sXXXXXX",xsddefault_temp_file);
xsddefault_aggregate_temp_file[sizeof(xsddefault_aggregate_temp_file)-1]='\x0';
- if((xsddefault_aggregate_fd=mkstemp(xsddefault_aggregate_temp_file))==-1)
+ if((xsddefault_aggregate_fd=mkstemp(xsddefault_aggregate_temp_file))==-1){
+ /* log an error */
+ snprintf(temp_buffer,sizeof(temp_buffer),"Error: Unable to create temp file for writing status data!\n");
+ temp_buffer[sizeof(temp_buffer)-1]='\x0';
+ write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
return ERROR;
+ }
xsddefault_aggregate_fp=fdopen(xsddefault_aggregate_fd,"w");
if(xsddefault_aggregate_fp==NULL){
close(xsddefault_aggregate_fd);
unlink(xsddefault_aggregate_temp_file);
+ /* log an error */
+ snprintf(temp_buffer,sizeof(temp_buffer),"Error: Unable to open temp file '%s' for writing status data!\n",xsddefault_aggregate_temp_file);
+ temp_buffer[sizeof(temp_buffer)-1]='\x0';
+ write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
return ERROR;
}
@@ -232,6 +242,7 @@
/* finish aggregated dump */
int xsddefault_end_aggregated_dump(void){
+ char temp_buffer[MAX_INPUT_BUFFER];
/* reset file permissions */
fchmod(xsddefault_aggregate_fd,S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
@@ -241,8 +252,13 @@
close(xsddefault_aggregate_fd);
/* move the temp file to the status log (overwrite the old status log) */
- if(my_rename(xsddefault_aggregate_temp_file,xsddefault_status_log))
+ if(my_rename(xsddefault_aggregate_temp_file,xsddefault_status_log)){
+ /* log an error */
+ snprintf(temp_buffer,sizeof(temp_buffer),"Error: Unable to update status data file '%s'!\n",xsddefault_status_log);
+ temp_buffer[sizeof(temp_buffer)-1]='\x0';
+ write_to_logs_and_console(temp_buffer,NSLOG_RUNTIME_ERROR,TRUE);
return ERROR;
+ }
return OK;
}
More information about the Pkg-nagios-changes
mailing list