summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7f7188e)
raw | patch | inline | side by side (parent: 7f7188e)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 16 Jan 2003 05:17:10 +0000 (05:17 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Thu, 16 Jan 2003 05:17:10 +0000 (05:17 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@240 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_by_ssh.c | patch | blob | history |
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 5c5053092541f0c5f98644254cacdfcdc855a6c8..34e6727478c17d0f3e0e45edb3794cddb0998ffc 100644 (file)
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
c = optind;
if (hostname == NULL) {
- if (!is_host (argv[c]))
+ if (c <= argc) {
+ terminate (STATE_UNKNOWN, "%s: You must provide a host name\n", progname);
+ } else if (!is_host (argv[c]))
terminate (STATE_UNKNOWN, "%s: Invalid host name %s\n", progname, argv[c]);
hostname = argv[c++];
}
if (strlen(remotecmd) == 0) {
for (; c < argc; c++)
- asprintf (&remotecmd, "%s %s", remotecmd, argv[c]);
+ if (strlen(remotecmd) > 0)
+ asprintf (&remotecmd, "%s %s", remotecmd, argv[c]);
+ else
+ asprintf (&remotecmd, "%s", argv[c]);
}
if (commands > 1)