diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index 975986da6275bbcef2cbd41d38736f0ca3d8fb36..5c6f1e12e8bdb45985d0ac535d8c79bdcab1de42 100644 (file)
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
#include "utils.h"
#include "popen.h"
-#define PROGNAME "check_dig"
+const char *progname = "check_dig";
#define REVISION "$Revision$"
#define COPYRIGHT "2000-2002"
#define AUTHOR "Karl DeBisschop"
input_buffer[strcspn (input_buffer, "\r\n")] = '\0';
if (strstr (input_buffer, query_address) == input_buffer) {
- output = strscpy (output, input_buffer);
+ asprintf (&output, input_buffer);
result = STATE_OK;
}
else {
- strscpy (output, "Server not found in ANSWER SECTION");
+ asprintf (&output, "Server not found in ANSWER SECTION");
result = STATE_WARNING;
}
}
if (result != STATE_OK) {
- strscpy (output, "No ANSWER SECTION found");
+ asprintf (&output, "No ANSWER SECTION found");
}
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) {
result = max_state (result, STATE_WARNING);
printf ("%s", input_buffer);
if (strlen (output) == 0)
- strscpy (output, 1 + index (input_buffer, ':'));
+ asprintf (&output, 1 + index (input_buffer, ':'));
}
(void) fclose (child_stderr);
if (spclose (child_process)) {
result = max_state (result, STATE_WARNING);
if (strlen (output) == 0)
- strscpy (output, "dig returned error status");
+ asprintf (&output, "dig returned error status");
}
(void) time (&end_time);
- if (output == NULL || strcmp (output, "") == 0 || strlen (output) == 0 || strspn (output, " \t\r\n") == strlen (output))
- strscpy (output, " Probably a non-existent host/domain");
+ if (output == NULL || strlen (output) == 0)
+ asprintf (&output, " Probably a non-existent host/domain");
if (result == STATE_OK)
printf ("DNS ok - %d seconds response time (%s)\n",
}
break;
case 'V': /* version */
- print_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
exit (STATE_OK);
case 'h': /* help */
print_help ();
}
}
else {
- dns_server = strscpy (NULL, "127.0.0.1");
+ asprintf (&dns_server, "127.0.0.1");
}
}
void
print_help (void)
{
- print_revision (PROGNAME, "$Revision$");
+ print_revision (progname, "$Revision$");
printf
("Copyright (c) %s %s <%s>\n\n%s\n",
COPYRIGHT, AUTHOR, EMAIL, SUMMARY);
printf
("Usage: %s -H host -l lookup [-t timeout] [-v]\n"
" %s --help\n"
- " %s --version\n", PROGNAME, PROGNAME, PROGNAME);
+ " %s --version\n", progname, progname, progname);
}