[Nagios-checkins] CVS: nagios/cgi cmd.c,1.1.1.1,1.2

Ethan Galstad egalstad at users.sourceforge.net
Thu Feb 28 17:46:02 UTC 2002


Update of /cvsroot/nagios/nagios/cgi
In directory usw-pr-cvs1:/tmp/cvs-serv15630

Modified Files:
	cmd.c 
Log Message:
Check for external command file using stat()

Index: cmd.c
===================================================================
RCS file: /cvsroot/nagios/nagios/cgi/cmd.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** cmd.c	26 Feb 2002 04:03:32 -0000	1.1.1.1
--- cmd.c	1 Mar 2002 01:45:40 -0000	1.2
***************
*** 4,8 ****
   *
   * Copyright (c) 1999-2002 Ethan Galstad (nagios at nagios.org)
!  * Last Modified: 01-29-2002
   *
   * License:
--- 4,8 ----
   *
   * Copyright (c) 1999-2002 Ethan Galstad (nagios at nagios.org)
!  * Last Modified: 02-28-2002
   *
   * License:
***************
*** 1801,1804 ****
--- 1801,1820 ----
  int write_command_to_file(char *cmd){
  	FILE *fp;
+ 	struct stat statbuf;
+ 
+ 	/* bail out if the external command file doesn't exist */
+ 	if(stat(command_file,&statbuf)){
+ 
+ 		if(content_type==WML_CONTENT)
+ 			printf("<p>Error: Could not stat() external command file!</p>\n");
+ 		else{
+ 			printf("<P><DIV CLASS='errorMessage'>Error: Could not stat() command file '%s'!</DIV></P>\n",command_file);
+ 			printf("<P><DIV CLASS='errorDescription'>");
+ 			printf("The external command file may be missing, Nagios may not be running, and/or Nagios may not be checking external commands.\n");
+ 			printf("</DIV></P>\n");
+ 			}
+ 
+ 		return ERROR;
+ 	        }
  
   	/* open the command for writing (since this is a pipe, it will really be appended) */





More information about the Nagios-commits mailing list