[Nagiosplug-checkins] CVS: nagiosplug/plugins popen.c,1.3,1.4

Karl DeBisschop kdebisschop at users.sourceforge.net
Thu Jul 31 23:02:08 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv4453/plugins

Modified Files:
	popen.c 
Log Message:
set LC_ALL to C in execve environemnt

Index: popen.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/popen.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** popen.c	13 Jan 2003 12:13:56 -0000	1.3
--- popen.c	1 Aug 2003 06:01:50 -0000	1.4
***************
*** 68,72 ****
  spopen (const char *cmdstring)
  {
! 	char *environ[] = { NULL };
  	char *cmd = NULL;
  	char **argv = NULL;
--- 68,72 ----
  spopen (const char *cmdstring)
  {
! 	char *env[] = { "LC_ALL=C", (char*)0 };
  	char *cmd = NULL;
  	char **argv = NULL;
***************
*** 183,187 ****
  				close (i);
  
! 		execve (argv[0], argv, environ);
  		_exit (0);
  	}
--- 183,187 ----
  				close (i);
  
! 		execve (argv[0], argv, env);
  		_exit (0);
  	}
***************
*** 200,204 ****
  spclose (FILE * fp)
  {
! 	int fd, stat;
  	pid_t pid;
  
--- 200,204 ----
  spclose (FILE * fp)
  {
! 	int fd, status;
  	pid_t pid;
  
***************
*** 214,223 ****
  		return (1);
  
! 	while (waitpid (pid, &stat, 0) < 0)
  		if (errno != EINTR)
  			return (1);							/* error other than EINTR from waitpid() */
  
! 	if (WIFEXITED (stat))
! 		return (WEXITSTATUS (stat));	/* return child's termination status */
  
  	return (1);
--- 214,223 ----
  		return (1);
  
! 	while (waitpid (pid, &status, 0) < 0)
  		if (errno != EINTR)
  			return (1);							/* error other than EINTR from waitpid() */
  
! 	if (WIFEXITED (status))
! 		return (WEXITSTATUS (status));	/* return child's termination status */
  
  	return (1);





More information about the Commits mailing list