[Nagiosplug-checkins] CVS: nagiosplug/plugins negate.c,1.1,1.2
Karl DeBisschop
kdebisschop at users.sourceforge.net
Sun Oct 6 18:20:02 CEST 2002
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv26250/plugins
Modified Files:
negate.c
Log Message:
use asprintf, inhibit splint warning
Index: negate.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/negate.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** negate.c 8 Sep 2002 12:05:47 -0000 1.1
--- negate.c 7 Oct 2002 01:19:36 -0000 1.2
***************
*** 121,135 ****
/* Set signal handling and alarm */
! if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) {
! printf ("Cannot catch SIGALRM");
! return STATE_UNKNOWN;
! }
! alarm (timeout_interval);
child_process = spopen (command_line);
! if (child_process == NULL) {
! printf ("Could not open pipe: %s\n", command_line);
! exit (STATE_UNKNOWN);
! }
child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
--- 121,132 ----
/* Set signal handling and alarm */
! if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR)
! terminate (STATE_UNKNOWN, "Cannot catch SIGALRM");
!
! (void) alarm ((unsigned) timeout_interval);
child_process = spopen (command_line);
! if (child_process == NULL)
! terminate (STATE_UNKNOWN, "Could not open pipe: %s\n", command_line);
child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
***************
*** 140,144 ****
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
found++;
! if (index (input_buffer, '\n')) {
input_buffer[strcspn (input_buffer, "\n")] = 0;
printf ("%s\n", input_buffer);
--- 137,141 ----
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
found++;
! if (strchr (input_buffer, '\n')) {
input_buffer[strcspn (input_buffer, "\n")] = 0;
printf ("%s\n", input_buffer);
***************
*** 149,157 ****
}
! if (!found) {
! printf ("%s problem - No data recieved from host\nCMD: %s\n", argv[0],
! command_line);
! exit (STATE_UNKNOWN);
! }
/* close the pipe */
--- 146,153 ----
}
! if (!found)
! terminate (STATE_UNKNOWN,\
! "%s problem - No data recieved from host\nCMD: %s\n",\
! argv[0], command_line);
/* close the pipe */
***************
*** 166,174 ****
if (result == STATE_OK)
! return STATE_CRITICAL;
else if (result == STATE_CRITICAL)
! return STATE_OK;
else
! return result;
}
--- 162,170 ----
if (result == STATE_OK)
! exit (STATE_CRITICAL);
else if (result == STATE_CRITICAL)
! exit (EXIT_SUCCESS);
else
! exit (result);
}
***************
*** 252,259 ****
case 'h': /* help */
print_help ();
! exit (STATE_OK);
case 'V': /* version */
print_revision (PROGNAME, REVISION);
! exit (STATE_OK);
case 't': /* timeout period */
if (!is_integer (optarg))
--- 248,255 ----
case 'h': /* help */
print_help ();
! exit (EXIT_SUCCESS);
case 'V': /* version */
print_revision (PROGNAME, REVISION);
! exit (EXIT_SUCCESS);
case 't': /* timeout period */
if (!is_integer (optarg))
***************
*** 266,270 ****
command_line = strscpy (command_line, argv[optind]);
for (c = optind+1; c <= argc; c++) {
! command_line = ssprintf (command_line, "%s %s", command_line, argv[c]);
}
--- 262,266 ----
command_line = strscpy (command_line, argv[optind]);
for (c = optind+1; c <= argc; c++) {
! asprintf (&command_line, "%s %s", command_line, argv[c]);
}
***************
*** 287,291 ****
validate_arguments ()
{
! return OK;
}
--- 283,287 ----
validate_arguments ()
{
! return STATE_OK;
}
More information about the Commits
mailing list