Просмотр исходного кода

Fixes to compile on Solaris 10, and fixes to argument handling.

John C. Frickson 9 лет назад
Родитель
Сommit
5c242585b6
3 измененных файлов с 9 добавлено и 4 удалено
  1. 3 0
      configure.ac
  2. 2 0
      plugins-root/check_icmp.c
  3. 4 4
      plugins/check_hpjd.c

+ 3 - 0
configure.ac

@@ -1663,6 +1663,9 @@ AC_CHECK_MEMBERS([struct swapent.se_nblks],,,[
                  #include <sys/stat.h>
                  #include <sys/stat.h>
                  #include <sys/swap.h>
                  #include <sys/swap.h>
                  ])
                  ])
+AC_CHECK_MEMBERS([struct msghdr.msg_control, struct msghdr.msg_controllen],
+		AC_DEFINE([HAVE_MSGHDR_MSG_CONTROL],1,
+		          [Define if struct msghdr has msg_control and msg_controllen]))
 
 
 if test "$ac_cv_have_decl_swapctl" = "yes";
 if test "$ac_cv_have_decl_swapctl" = "yes";
 then
 then

+ 2 - 0
plugins-root/check_icmp.c

@@ -962,8 +962,10 @@ recvfrom_wto(int sock, void *buf, unsigned int len, struct sockaddr *saddr,
 	hdr.msg_namelen = slen;
 	hdr.msg_namelen = slen;
 	hdr.msg_iov = &iov;
 	hdr.msg_iov = &iov;
 	hdr.msg_iovlen = 1;
 	hdr.msg_iovlen = 1;
+#ifdef HAVE_MSGHDR_MSG_CONTROL
 	hdr.msg_control = ans_data;
 	hdr.msg_control = ans_data;
 	hdr.msg_controllen = sizeof(ans_data);
 	hdr.msg_controllen = sizeof(ans_data);
+#endif
 
 
 	ret = recvmsg(sock, &hdr, 0);
 	ret = recvmsg(sock, &hdr, 0);
 #ifdef SO_TIMESTAMP
 #ifdef SO_TIMESTAMP

+ 4 - 4
plugins/check_hpjd.c

@@ -66,7 +66,7 @@ void print_usage (void);
 
 
 char *community = NULL;
 char *community = NULL;
 char *address = NULL;
 char *address = NULL;
-char *port = NULL;
+int port = 0;
 
 
 int
 int
 main (int argc, char **argv)
 main (int argc, char **argv)
@@ -371,14 +371,14 @@ process_arguments (int argc, char **argv)
 
 
 	if (community == NULL) {
 	if (community == NULL) {
 		if (argv[c] != NULL )
 		if (argv[c] != NULL )
-			community = argv[c];
+			community = argv[c++];
 		else
 		else
 			community = strdup (DEFAULT_COMMUNITY);
 			community = strdup (DEFAULT_COMMUNITY);
 	}
 	}
 
 
-	if (port == NULL) {
+	if (port == 0) {
 		if (argv[c] != NULL )
 		if (argv[c] != NULL )
-			port = argv[c];
+			port = atoi (argv[c++]);
 		else
 		else
 			port = atoi (DEFAULT_PORT);
 			port = atoi (DEFAULT_PORT);
 	}
 	}