[Nagios-devel] Minor fixes
Posted: Wed Apr 27, 2005 11:38 am
This is a multi-part message in MIME format.
--------------000200000302050801040102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Ahoy all.
It's been awfully quiet on this list for quite some time, so I thought
it was time to make something happen.
Attached are two patches. One (nagios-clean-compile.diff) that makes
Nagios base build cleanly with all the warnings of base/Makefile (at
least on x86 with gcc-3.4.3, glibc-2.3.3 and headers from the 2.4.30
kernel).
The other (nagios-wide-std-conform.diff) replaces bzero(3) and index(3)
calls with memset(3) and strchr(3), respectively. The reason for this is
that memset and strchr conforms to SVID3, ISO9899 and BSD4.3, while
bzero and index only conforms to BSD4.3. bzero is also deprecated
according to the man-page.
Apply with patch -p1. nagios-clean-compile needs to be applied first.
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Lead Developer
--------------000200000302050801040102
Content-Type: text/plain;
name="nagios-wide-std-conform.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="nagios-wide-std-conform.diff"
diff -urN ../nagios.orig/base/utils.c ./base/utils.c
--- ../nagios.orig/base/utils.c Wed Apr 27 17:45:02 2005
+++ ./base/utils.c Wed Apr 27 17:44:07 2005
@@ -3703,7 +3703,7 @@
return -1;
/* clear the message buffer */
- bzero((void *)message,sizeof(service_message));
+ memset((void *)message,0,sizeof(service_message));
/* get a lock on the buffer */
pthread_mutex_lock(&service_result_buffer.buffer_lock);
@@ -4079,10 +4079,10 @@
if(sequence_head[0]=='\x0')
return NULL;
- token_position=index(my_strtok_buffer,tokens[0]);
+ token_position=strchr(my_strtok_buffer,tokens[0]);
if(token_position==NULL){
- my_strtok_buffer=index(my_strtok_buffer,'\x0');
+ my_strtok_buffer=strchr(my_strtok_buffer,'\x0');
return sequence_head;
}
@@ -4690,7 +4690,7 @@
if(buffer_itemstm_zone
+#else
+# define tzone (tm_ptr->tm_isdst)?tzname[1]:tzname[0]
+#endif
/* given a date/time in time_t format, produce a corresponding date/time string, including timezone */
void get_datetime_string(time_t *raw_time,char *buffer,int buffer_length, int type){
time_t t;
@@ -3129,7 +3137,6 @@
int year;
char *weekdays[7]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
char *months[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"};
- char *tzone="";
if(raw_time==NULL)
time(&t);
@@ -3145,12 +3152,6 @@
day=tm_ptr->tm_mday;
year=tm_ptr->tm_year+1900;
-#ifdef HAVE_TM_ZONE
- tzone=(char *)tm_ptr->tm_zone;
-#else
- tzone=(tm_ptr->tm_isdst)?tzname[1]:tzname[0];
-#endif
-
/* ctime() style date/time */
if(type==LONG_DATE_TIME)
snprintf(buffer,buffer_length,"%s %s %d %02d:%02d:%02d %s %d",weekdays[tm_ptr->tm_wday],months[tm_ptr->tm_mon],day,hour,minute,second,tzone,year);
@@ -3183,7 +3184,8 @@
return;
}
-
+/* d
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
--------------000200000302050801040102
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Ahoy all.
It's been awfully quiet on this list for quite some time, so I thought
it was time to make something happen.
Attached are two patches. One (nagios-clean-compile.diff) that makes
Nagios base build cleanly with all the warnings of base/Makefile (at
least on x86 with gcc-3.4.3, glibc-2.3.3 and headers from the 2.4.30
kernel).
The other (nagios-wide-std-conform.diff) replaces bzero(3) and index(3)
calls with memset(3) and strchr(3), respectively. The reason for this is
that memset and strchr conforms to SVID3, ISO9899 and BSD4.3, while
bzero and index only conforms to BSD4.3. bzero is also deprecated
according to the man-page.
Apply with patch -p1. nagios-clean-compile needs to be applied first.
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Lead Developer
--------------000200000302050801040102
Content-Type: text/plain;
name="nagios-wide-std-conform.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="nagios-wide-std-conform.diff"
diff -urN ../nagios.orig/base/utils.c ./base/utils.c
--- ../nagios.orig/base/utils.c Wed Apr 27 17:45:02 2005
+++ ./base/utils.c Wed Apr 27 17:44:07 2005
@@ -3703,7 +3703,7 @@
return -1;
/* clear the message buffer */
- bzero((void *)message,sizeof(service_message));
+ memset((void *)message,0,sizeof(service_message));
/* get a lock on the buffer */
pthread_mutex_lock(&service_result_buffer.buffer_lock);
@@ -4079,10 +4079,10 @@
if(sequence_head[0]=='\x0')
return NULL;
- token_position=index(my_strtok_buffer,tokens[0]);
+ token_position=strchr(my_strtok_buffer,tokens[0]);
if(token_position==NULL){
- my_strtok_buffer=index(my_strtok_buffer,'\x0');
+ my_strtok_buffer=strchr(my_strtok_buffer,'\x0');
return sequence_head;
}
@@ -4690,7 +4690,7 @@
if(buffer_itemstm_zone
+#else
+# define tzone (tm_ptr->tm_isdst)?tzname[1]:tzname[0]
+#endif
/* given a date/time in time_t format, produce a corresponding date/time string, including timezone */
void get_datetime_string(time_t *raw_time,char *buffer,int buffer_length, int type){
time_t t;
@@ -3129,7 +3137,6 @@
int year;
char *weekdays[7]={"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
char *months[12]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"};
- char *tzone="";
if(raw_time==NULL)
time(&t);
@@ -3145,12 +3152,6 @@
day=tm_ptr->tm_mday;
year=tm_ptr->tm_year+1900;
-#ifdef HAVE_TM_ZONE
- tzone=(char *)tm_ptr->tm_zone;
-#else
- tzone=(tm_ptr->tm_isdst)?tzname[1]:tzname[0];
-#endif
-
/* ctime() style date/time */
if(type==LONG_DATE_TIME)
snprintf(buffer,buffer_length,"%s %s %d %02d:%02d:%02d %s %d",weekdays[tm_ptr->tm_wday],months[tm_ptr->tm_mon],day,hour,minute,second,tzone,year);
@@ -3183,7 +3184,8 @@
return;
}
-
+/* d
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]