[Nagios-devel] patch: small segfault fixes

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] patch: small segfault fixes

Post by Guest »

--=-PMHBPNg4MpJ0ssfg5+qB
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Couple tiny fixes for latest copy in cvs. Fixes a segfault I was getting
for not having host_perfdata_file/service_perfata_file defined in my
nagios.cfg

--
Matthew Kent
http://magoazul.com

--=-PMHBPNg4MpJ0ssfg5+qB
Content-Disposition: attachment; filename=nagios-2.0a1-bugfixes.patch
Content-Type: text/x-patch; name=nagios-2.0a1-bugfixes.patch; charset=ANSI_X3.4-1968
Content-Transfer-Encoding: 7bit

diff -u3r nagios_orig/base/utils.c nagios/base/utils.c
--- nagios_orig/base/utils.c 2004-09-02 20:53:00.000000000 -0400
+++ nagios/base/utils.c 2004-09-11 13:31:16.000000000 -0400
@@ -2717,7 +2717,7 @@
run_time-=3600;

#ifdef DEBUG1
- printf("\tNext Log Rotation Time: %s",ctime(run_time));
+ printf("\tNext Log Rotation Time: %s",ctime((time_t*) run_time));
#endif

#ifdef DEBUG0
diff -u3r nagios_orig/xdata/xpddefault.c nagios/xdata/xpddefault.c
--- nagios_orig/xdata/xpddefault.c 2004-09-02 20:53:00.000000000 -0400
+++ nagios/xdata/xpddefault.c 2004-09-11 14:27:39.000000000 -0400
@@ -181,14 +181,16 @@
/* save the host perf data file macro */
if(macro_x[MACRO_HOSTPERFDATAFILE]!=NULL)
free(macro_x[MACRO_HOSTPERFDATAFILE]);
- macro_x[MACRO_HOSTPERFDATAFILE]=(char *)strdup(xpddefault_host_perfdata_file);
+ if (xpddefault_host_perfdata_file!=NULL)
+ macro_x[MACRO_HOSTPERFDATAFILE]=(char *)strdup(xpddefault_host_perfdata_file);
if(macro_x[MACRO_HOSTPERFDATAFILE]!=NULL)
strip(macro_x[MACRO_HOSTPERFDATAFILE]);

/* save the service perf data file macro */
if(macro_x[MACRO_SERVICEPERFDATAFILE]!=NULL)
free(macro_x[MACRO_SERVICEPERFDATAFILE]);
- macro_x[MACRO_SERVICEPERFDATAFILE]=(char *)strdup(xpddefault_service_perfdata_file);
+ if (xpddefault_service_perfdata_file!=NULL)
+ macro_x[MACRO_SERVICEPERFDATAFILE]=(char *)strdup(xpddefault_service_perfdata_file);
if(macro_x[MACRO_SERVICEPERFDATAFILE]!=NULL)
strip(macro_x[MACRO_SERVICEPERFDATAFILE]);


--=-PMHBPNg4MpJ0ssfg5+qB--






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked