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

Karl DeBisschop kdebisschop at users.sourceforge.net
Mon Jan 13 04:14:04 CET 2003


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

Modified Files:
	popen.c 
Log Message:
change exit status to be POSIX compliant

Index: popen.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/popen.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** popen.c	7 Oct 2002 01:34:46 -0000	1.2
--- popen.c	13 Jan 2003 12:13:56 -0000	1.3
***************
*** 204,225 ****
  
  	if (childpid == NULL)
! 		return (-1);								/* popen() has never been called */
  
  	fd = fileno (fp);
  	if ((pid = childpid[fd]) == 0)
! 		return (-1);								/* fp wasn't opened by popen() */
  
  	childpid[fd] = 0;
  	if (fclose (fp) == EOF)
! 		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 (STATE_UNKNOWN);
  }
  
--- 204,225 ----
  
  	if (childpid == NULL)
! 		return (1);								/* popen() has never been called */
  
  	fd = fileno (fp);
  	if ((pid = childpid[fd]) == 0)
! 		return (1);								/* fp wasn't opened by popen() */
  
  	childpid[fd] = 0;
  	if (fclose (fp) == EOF)
! 		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);
  }
  





More information about the Commits mailing list