--- nrpe-2.12/src/nrpe.c.p1 2008-03-11 07:04:43 +1000 +++ nrpe-2.12/src/nrpe.c 2008-04-29 02:56:48 +1100 @@ -18,6 +18,8 @@ * ******************************************************************************/ +#define _GNU_SOURCE + #include "../include/common.h" #include "../include/config.h" #include "../include/nrpe.h" @@ -92,11 +94,12 @@ int main(int argc, char **argv){ char seedfile[FILENAME_MAX]; int i,c; #endif - + int tmp; + char *ctmp=NULL; /* set some environment variables */ - asprintf(&env_string,"NRPE_MULTILINESUPPORT=1"); + tmp=asprintf(&env_string,"NRPE_MULTILINESUPPORT=1"); putenv(env_string); - asprintf(&env_string,"NRPE_PROGRAMVERSION=%s",PROGRAM_VERSION); + tmp=asprintf(&env_string,"NRPE_PROGRAMVERSION=%s",PROGRAM_VERSION); putenv(env_string); /* process command-line args */ @@ -176,7 +179,7 @@ int main(int argc, char **argv){ /* get absolute path of current working directory */ strcpy(config_file,""); - getcwd(config_file,sizeof(config_file)); + ctmp=getcwd(config_file,sizeof(config_file)); /* append a forward slash */ strncat(config_file,"/",sizeof(config_file)-2); @@ -283,7 +286,7 @@ int main(int argc, char **argv){ open("/dev/null",O_WRONLY); open("/dev/null",O_WRONLY); - chdir("/"); + tmp=chdir("/"); /*umask(0);*/ /* handle signals */ @@ -698,7 +701,7 @@ void wait_for_connections(void){ struct sockaddr_in *nptr; struct sockaddr addr; int rc; - int sock, new_sd; + int sock, new_sd=-1; socklen_t addrlen; pid_t pid; int flag=1; @@ -1326,7 +1329,7 @@ int my_system(char *command,int timeout, FILE *fp; int bytes_read=0; time_t start_time,end_time; - + int tmp; /* initialize return variables */ if(output!=NULL) strcpy(output,""); @@ -1337,7 +1340,7 @@ int my_system(char *command,int timeout, return STATE_OK; /* create a pipe */ - pipe(fd); + tmp=pipe(fd); /* make the pipe non-blocking */ fcntl(fd[0],F_SETFL,O_NONBLOCK); @@ -1390,7 +1393,7 @@ int my_system(char *command,int timeout, buffer[sizeof(buffer)-1]='\x0'; /* write the error back to the parent process */ - write(fd[1],buffer,strlen(buffer)+1); + tmp=write(fd[1],buffer,strlen(buffer)+1); result=STATE_CRITICAL; } @@ -1400,7 +1403,7 @@ int my_system(char *command,int timeout, while((bytes_read=fread(buffer,1,sizeof(buffer)-1,fp))>0){ /* write the output back to the parent process */ - write(fd[1],buffer,bytes_read); + tmp=write(fd[1],buffer,bytes_read); } /* close the command and get termination status */ @@ -1580,7 +1583,7 @@ int write_pid_file(void){ int result=0; pid_t pid=0; char pbuf[16]; - + int tmp; /* no pid file was specified */ if(pid_file==NULL) return OK; @@ -1612,7 +1615,7 @@ int write_pid_file(void){ /* write new pid file */ if((fd=open(pid_file,O_WRONLY | O_CREAT,0644))>=0){ sprintf(pbuf,"%d\n",(int)getpid()); - write(fd,pbuf,strlen(pbuf)); + tmp=write(fd,pbuf,strlen(pbuf)); close(fd); wrote_pid_file=TRUE; } @@ -1638,7 +1641,7 @@ int remove_pid_file(void){ /* remove existing pid file */ if(unlink(pid_file)==-1){ - syslog(LOG_ERR,"Cannot remove pidfile '%s' - check your privileges.",pid_file); + /* syslog(LOG_ERR,"Cannot remove pidfile '%s' - check your privileges.",pid_file); */ return ERROR; }