diff -urN ../nagios.orig/base/utils.c ./base/utils.c
--- ../nagios.orig/base/utils.c	Wed Apr 27 17:43:06 2005
+++ ./base/utils.c	Wed Apr 27 17:43:00 2005
@@ -221,7 +221,10 @@
 extern circular_buffer service_result_buffer;
 extern circular_buffer event_broker_buffer;
 
+/* from GNU defines errno as a macro, since it's a per-thread variable */
+#ifndef errno
 extern int errno;
+#endif
 
 
 
@@ -2377,10 +2380,10 @@
 
 
 /* saves the name of a macro */
-int add_macrox_name(int index, char *name){
+int add_macrox_name(int i, char *name){
 
 	/* dup the macro name */
-	macro_x_names[index]=strdup(name);
+	macro_x_names[i]=strdup(name);
 
 	return OK;
         }
@@ -3117,6 +3120,11 @@
 	
 	 
 
+#ifdef HAVE_TM_ZONE
+# define tzone tm_ptr->tm_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;
         }
-
+/* don't mess up other functions that might want to call a variable 'tzone' */
+#undef tzone
 
 
 /* get the next time to schedule a log rotation */
@@ -4384,7 +4386,7 @@
 
 	/* find the end of the string (or buffer) */
 	for(x=temp_mmapfile->current_position;x<temp_mmapfile->file_size;x++){
-		if(*(char *)(temp_mmapfile->mmap_buf+x)=='\n'){
+		if(*(char *)((char *)temp_mmapfile->mmap_buf+x)=='\n'){
 			x++;
 			break;
 			}
@@ -4398,7 +4400,7 @@
 		return NULL;
 
 	/* copy string to newly allocated memory and terminate the string */
-	memcpy(buf,(char *)(temp_mmapfile->mmap_buf+temp_mmapfile->current_position),len);
+	memcpy(buf,(char *)((char *)temp_mmapfile->mmap_buf+temp_mmapfile->current_position),len);
 	buf[len]='\x0';
 
 	/* update the current position */
