瀏覽代碼

check_nt does not correctly report a DNS entry it cannot resolve

Fix for issue https://github.com/nagios-plugins/nagios-plugins/issues/67
John C. Frickson 10 年之前
父節點
當前提交
e68e013faf
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      plugins/netutils.c

+ 4 - 1
plugins/netutils.c

@@ -209,7 +209,10 @@ np_net_connect (const char *host_name, int port, int *sd, int proto)
 		result = getaddrinfo (host, port_str, &hints, &res);
 
 		if (result != 0) {
-			printf ("%s\n", gai_strerror (result));
+			if (result == EAI_NONAME)
+				usage_va(_("Invalid hostname/address - %s"), host);
+			else
+				printf ("%s\n", gai_strerror (result));
 			return STATE_UNKNOWN;
 		}