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

fix a variety of compiler warnings about qualifier discards and other pedantic stuff

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@662 f882894a-f735-0410-b71e-b25c423dba1c
Karl DeBisschop 22 лет назад
Родитель
Сommit
65ca899d2c
7 измененных файлов с 240 добавлено и 223 удалено
  1. 104 99
      plugins/check_by_ssh.c
  2. 119 107
      plugins/check_disk.c
  3. 3 3
      plugins/check_nt.c
  4. 3 3
      plugins/netutils.c
  5. 2 2
      plugins/netutils.h
  6. 1 1
      plugins/popen.h
  7. 8 8
      plugins/utils.h

+ 104 - 99
plugins/check_by_ssh.c

@@ -1,25 +1,19 @@
 /******************************************************************************
- *
- * This file is part of the Nagios Plugins.
- *
- * Copyright (c) 1999, 2000, 2001 Karl DeBisschop <karl@debisschop.net>
- *
- * The Nagios Plugins are free software; you can redistribute them
- * and/or modify them under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- *
+
+ The Nagios Plugins are free software; you can redistribute them
+ and/or modify them under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
  *****************************************************************************/
  
 const char *progname = "check_by_ssh";
@@ -27,7 +21,6 @@ const char *revision = "$Revision$";
 const char *copyright = "2000-2003";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
-#include "config.h"
 #include "common.h"
 #include "netutils.h"
 #include "utils.h"
@@ -38,83 +31,10 @@ int validate_arguments (void);
 void print_help (void);
 void print_usage (void);
 
-void
-print_help (void)
-{
-	print_revision (progname, revision);
-
-	printf (_(COPYRIGHT), copyright, email);
-
-	printf (_("This plugin uses SSH to execute commands on a remote host\n\n"));
-
-	print_usage ();
-
-	printf (_(UT_HELP_VRSN));
-
-	printf (_(UT_HOST_PORT), 'p', "none");
-
-	printf (_(UT_IPv46));
-
-	printf (_("\
- -1, --proto1\n\
-    tell ssh to use Protocol 1\n\
- -2, --proto2\n\
-    tell ssh to use Protocol 2\n\
- -f\n\
-    tells ssh to fork rather than create a tty\n"));
-
-	printf (_("\
- -C, --command='COMMAND STRING'\n\
-    command to execute on the remote machine\n\
- -l, --logname=USERNAME\n\
-    SSH user name on remote host [optional]\n\
- -i, --identity=KEYFILE\n\
-    identity of an authorized key [optional]\n\
- -O, --output=FILE\n\
-    external command file for nagios [optional]\n\
- -s, --services=LIST\n\
-    list of nagios service names, separated by ':' [optional]\n\
- -n, --name=NAME\n\
-    short name of host in nagios configuration [optional]\n"));
-
-	printf (_(UT_WARN_CRIT));
-
-	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
-
-	printf (_("\n\
-The most common mode of use is to refer to a local identity file with\n\
-the '-i' option. In this mode, the identity pair should have a null\n\
-passphrase and the public key should be listed in the authorized_keys\n\
-file of the remote host. Usually the key will be restricted to running\n\
-only one command on the remote server. If the remote SSH server tracks\n\
-invocation agruments, the one remote program may be an agent that can\n\
-execute additional commands as proxy\n"));
-
-	printf (_("\n\
-To use passive mode, provide multiple '-C' options, and provide\n\
-all of -O, -s, and -n options (servicelist order must match '-C'\n\
-options)\n"));
-}
-
-
-
-
-
-void
-print_usage (void)
-{
-	printf (_("Usage:\n\
-check_by_ssh [-f46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>\n\
-             [-n name] [-s servicelist] [-O outputfile] [-p port]\n\
-check_by_ssh  -V prints version info\n\
-check_by_ssh  -h prints more detailed help\n"));
-}
-
-
 int commands = 0;
 int services = 0;
-char *remotecmd = "";
-char *comm = SSH_COMMAND;
+char *remotecmd = NULL;
+char *comm = NULL;
 char *hostname = NULL;
 char *outputfile = NULL;
 char *host_shortname = NULL;
@@ -123,20 +43,26 @@ int passive = FALSE;
 int verbose = FALSE;
 
 
+
+
+
+
 int
 main (int argc, char **argv)
 {
 
 	char input_buffer[MAX_INPUT_BUFFER];
-	char *result_text = "";
+	char *result_text;
 	char *status_text;
-	char *output = "";
+	char *output;
 	char *eol = NULL;
 	int cresult;
 	int result = STATE_UNKNOWN;
 	time_t local_time;
 	FILE *fp = NULL;
 
+	asprintf (&remotecmd, "%s", "");
+	asprintf (&comm, "%s", SSH_COMMAND);
 
 	/* process arguments */
 	if (process_arguments (argc, argv) == ERROR)
@@ -235,6 +161,7 @@ main (int argc, char **argv)
 
 
 
+
 /* process command-line arguments */
 int
 process_arguments (int argc, char **argv)
@@ -392,3 +319,81 @@ validate_arguments (void)
 
 	return OK;
 }
+
+
+
+
+
+
+void
+print_help (void)
+{
+	print_revision (progname, revision);
+
+	printf (_("Copyright (c) 1999 Karl DeBisschop <kdebisschop@users.sourceforge.net>\n"));
+	printf (_(COPYRIGHT), copyright, email);
+
+	printf (_("This plugin uses SSH to execute commands on a remote host\n\n"));
+
+	print_usage ();
+
+	printf (_(UT_HELP_VRSN));
+
+	printf (_(UT_HOST_PORT), 'p', "none");
+
+	printf (_(UT_IPv46));
+
+	printf (_("\
+ -1, --proto1\n\
+    tell ssh to use Protocol 1\n\
+ -2, --proto2\n\
+    tell ssh to use Protocol 2\n\
+ -f\n\
+    tells ssh to fork rather than create a tty\n"));
+
+	printf (_("\
+ -C, --command='COMMAND STRING'\n\
+    command to execute on the remote machine\n\
+ -l, --logname=USERNAME\n\
+    SSH user name on remote host [optional]\n\
+ -i, --identity=KEYFILE\n\
+    identity of an authorized key [optional]\n\
+ -O, --output=FILE\n\
+    external command file for nagios [optional]\n\
+ -s, --services=LIST\n\
+    list of nagios service names, separated by ':' [optional]\n\
+ -n, --name=NAME\n\
+    short name of host in nagios configuration [optional]\n"));
+
+	printf (_(UT_WARN_CRIT));
+
+	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+
+	printf (_("\n\
+The most common mode of use is to refer to a local identity file with\n\
+the '-i' option. In this mode, the identity pair should have a null\n\
+passphrase and the public key should be listed in the authorized_keys\n\
+file of the remote host. Usually the key will be restricted to running\n\
+only one command on the remote server. If the remote SSH server tracks\n\
+invocation agruments, the one remote program may be an agent that can\n\
+execute additional commands as proxy\n"));
+
+	printf (_("\n\
+To use passive mode, provide multiple '-C' options, and provide\n\
+all of -O, -s, and -n options (servicelist order must match '-C'\n\
+options)\n"));
+}
+
+
+
+
+
+void
+print_usage (void)
+{
+	printf (_("\n\
+Usage: %s [-f46] [-t timeout] [-i identity] [-l user] -H <host> \n\
+  -C <command> [-n name] [-s servicelist] [-O outputfile] [-p port]\n"),
+	        progname);
+	printf (_(UT_HLP_VRS), progname, progname);
+}

+ 119 - 107
plugins/check_disk.c

@@ -35,80 +35,6 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
 # include <limits.h>
 #endif
 
-void
-print_usage (void)
-{
-	printf (_("\
-Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e]\n\
-        [-v] [-q]\n\
-       %s (-h|--help)\n\
-       %s (-V|--version)\n"),
-	        progname,  progname, progname);
-}
-
-void
-print_help (void)
-{
-	print_revision (progname, revision);
-
-	printf (_(COPYRIGHT), copyright, email);
-
-	printf (_("\
-This plugin checks the amount of used disk space on a mounted file system\n\
-and generates an alert if free space is less than one of the threshold values."));
-
-	print_usage ();
-
-	printf (_(UT_HELP_VRSN));
-
-	printf (_("\
- -w, --warning=INTEGER\n\
-   Exit with WARNING status if less than INTEGER kilobytes of disk are free\n\
- -w, --warning=PERCENT%%\n\
-   Exit with WARNING status if less than PERCENT of disk space is free\n\
- -c, --critical=INTEGER\n\
-   Exit with CRITICAL status if less than INTEGER kilobytes of disk are free\n\
- -c, --critical=PERCENT%%\n\
-   Exit with CRITCAL status if less than PERCENT of disk space is free\n\
- -C, --clear\n\
-    Clear thresholds\n"));
-
-	printf (_("\
- -u, --units=STRING\n\
-    Choose bytes, kB, MB, GB, TB (default: MB)\n\
- -k, --kilobytes\n\
-    Same as '--units kB'\n\
- -m, --megabytes\n\
-    Same as '--units MB'\n"));
-
-	printf (_("\
- -l, --local\n\
-    Only check local filesystems\n\
- -p, --path=PATH, --partition=PARTITION\n\
-    Path or partition (may be repeated)\n\
- -x, --exclude_device=PATH <STRING>\n\
-    Ignore device (only works if -p unspecified)\n\
- -X, --exclude-type=TYPE <STRING>\n\
-    Ignore all filesystems of indicated type (may be repeated)\n\
- -M, --mountpoint\n\
-    Display the mountpoint instead of the partition\n\
- -e, --errors-only\n\
-    Display only devices/mountpoints with errors\n"));
-
-	printf (_(UT_WARN_CRIT));
-
-	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
-
-	printf (_(UT_VERBOSE));
-
-	printf ("%s", _("Examples:\n\
- check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /\n\
-   Checks /tmp and /var at 10%,5% and / at 100MB, 50MB\n"));
-
-	support ();
-}
-
-
 /* If nonzero, show inode information. */
 /* static int inode_format; */
 
@@ -135,8 +61,8 @@ struct name_list
 {
   char *name;
   int found;
-  int w_df;
-  int c_df;
+  uintmax_t w_df;
+  uintmax_t c_df;
   double w_dfp;
   double c_dfp;
   struct name_list *name_next;
@@ -183,18 +109,21 @@ enum
 #endif
 
 int process_arguments (int, char **);
-int validate_arguments (int, int, double, double, char *);
-int check_disk (int usp, int free_disk);
+void print_path (char *mypath);
+int validate_arguments (uintmax_t, uintmax_t, double, double, char *);
+int check_disk (int usp, uintmax_t free_disk);
 int walk_name_list (struct name_list *list, const char *name);
+void print_help (void);
+void print_usage (void);
 
-int w_df = -1;
-int c_df = -1;
+uintmax_t w_df = 0;
+uintmax_t c_df = 0;
 double w_dfp = -1.0;
 double c_dfp = -1.0;
 char *path = "";
 char *exclude_device = "";
-char *units = "MB";
-unsigned long mult = 1024 * 1024;
+char *units = NULL;
+uintmax_t mult = 1024 * 1024;
 int verbose = 0;
 int erronly = FALSE;
 int display_mntp = FALSE;
@@ -202,10 +131,12 @@ int display_mntp = FALSE;
 /* Linked list of mounted filesystems. */
 static struct mount_entry *mount_list;
 
+
+
 int
 main (int argc, char **argv)
 {
-	int usp = -1;
+	double usp = -1.0;
 	int result = STATE_UNKNOWN;
 	int disk_result = STATE_UNKNOWN;
 	char file_system[MAX_INPUT_BUFFER];
@@ -244,7 +175,7 @@ main (int argc, char **argv)
 			get_fs_usage (me->me_mountdir, me->me_devname, &fsp);
 
 		if (fsp.fsu_blocks && strcmp ("none", me->me_mountdir)) {
-			usp = (fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
+			usp = (double)(fsp.fsu_blocks - fsp.fsu_bavail) * 100 / fsp.fsu_blocks;
 			disk_result = check_disk (usp, fsp.fsu_bavail);
 			result = max_state (disk_result, result);
 			if (disk_result==STATE_OK && erronly && !verbose)
@@ -364,7 +295,7 @@ process_arguments (int argc, char **argv)
 			}
 			else if (strpbrk (optarg, ",:") &&
 							 strstr (optarg, "%") &&
-							 sscanf (optarg, "%d%*[:,]%lf%%", &w_df, &w_dfp) == 2) {
+							 sscanf (optarg, "%ul%*[:,]%lf%%", &w_df, &w_dfp) == 2) {
 				break;
 			}
 			else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_dfp) == 1) {
@@ -380,7 +311,7 @@ process_arguments (int argc, char **argv)
 			}
 			else if (strpbrk (optarg, ",:") &&
 							 strstr (optarg, "%") &&
-							 sscanf (optarg, "%d%*[,:]%lf%%", &c_df, &c_dfp) == 2) {
+							 sscanf (optarg, "%ul%*[,:]%lf%%", &c_df, &c_dfp) == 2) {
 				break;
 			}
 			else if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_dfp) == 1) {
@@ -391,19 +322,19 @@ process_arguments (int argc, char **argv)
 			}
 		case 'u':
 			if (! strcmp (optarg, "bytes")) {
-				mult = 1;
+				mult = (uintmax_t)1;
 				units = "B";
 			} else if (! strcmp (optarg, "kB")) {
-				mult = 1024;
+				mult = (uintmax_t)1024;
 				units = "kB";
 			} else if (! strcmp (optarg, "MB")) {
-				mult = 1024 * 1024;
+				mult = (uintmax_t)1024 * 1024;
 				units = "MB";
 			} else if (! strcmp (optarg, "GB")) {
-				mult = 1024 * 1024 * 1024;
+				mult = (uintmax_t)1024 * 1024 * 1024;
 				units = "GB";
 			} else if (! strcmp (optarg, "TB")) {
-				mult = (unsigned long)1024 * 1024 * 1024 * 1024;
+				mult = (uintmax_t)1024 * 1024 * 1024 * 1024;
 				units = "TB";
 			} else {
 				die (STATE_UNKNOWN, _("unit type %s not known\n"), optarg);
@@ -458,8 +389,8 @@ process_arguments (int argc, char **argv)
 			display_mntp = TRUE;
 			break;
 		case 'C':
-			w_df = -1;
-			c_df = -1;
+			w_df = 0;
+			c_df = 0;
 			w_dfp = -1.0;
 			c_dfp = -1.0;
 			break;
@@ -477,10 +408,10 @@ process_arguments (int argc, char **argv)
 
 	/* Support for "check_disk warn crit [fs]" with thresholds at used level */
 	c = optind;
-	if (w_dfp == -1 && argc > c && is_intnonneg (argv[c]))
+	if (w_dfp < 0 && argc > c && is_intnonneg (argv[c]))
 		w_dfp = (100.0 - atof (argv[c++]));
 
-	if (c_dfp == -1 && argc > c && is_intnonneg (argv[c]))
+	if (c_dfp < 0 && argc > c && is_intnonneg (argv[c]))
 		c_dfp = (100.0 - atof (argv[c++]));
 
 	if (argc > c && strlen (path) == 0) {
@@ -520,9 +451,9 @@ void print_path (char *mypath)
 }
 
 int
-validate_arguments (int w, int c, double wp, double cp, char *mypath)
+validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath)
 {
-	if (w < 0 && c < 0 && wp < 0.0 && cp < 0.0) {
+	if (w == 0 && c == 0 && wp < 0.0 && cp < 0.0) {
 		printf (_("INPUT ERROR: No thresholds specified"));
 		print_path (mypath);
 		return ERROR;
@@ -535,10 +466,10 @@ INPUT ERROR: C_DFP (%f) should be less than W_DFP (%.1f) and both should be betw
 		print_path (path);
 		return ERROR;
 	}
-	else if ((w > 0 || c > 0) && (w < 0 || c < 0 || c > w)) {
+	else if ((w > 0 || c > 0) && (w == 0 || c == 0 || c > w)) {
 		printf (_("\
-INPUT ERROR: C_DF (%d) should be less than W_DF (%d) and both should be greater than zero"),
-		        c, w);
+INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greater than zero"),
+		        (unsigned long)c, (unsigned long)w);
 		print_path (path);
 		return ERROR;
 	}
@@ -551,17 +482,17 @@ INPUT ERROR: C_DF (%d) should be less than W_DF (%d) and both should be greater
 
 
 int
-check_disk (int usp, int free_disk)
+check_disk (int usp, uintmax_t free_disk)
 {
 	int result = STATE_UNKNOWN;
 	/* check the percent used space against thresholds */
-	if (usp >= 0 && usp >= (100.0 - c_dfp))
+	if (usp >= 0.0 && usp >= (100.0 - c_dfp))
 		result = STATE_CRITICAL;
-	else if (c_df >= 0 && free_disk <= c_df)
+	else if (c_df > 0 && free_disk <= c_df)
 		result = STATE_CRITICAL;
-	else if (usp >= 0 && usp >= (100.0 - w_dfp))
+	else if (usp >= 0.0 && usp >= (100.0 - w_dfp))
 		result = STATE_WARNING;
-	else if (w_df >= 0 && free_disk <= w_df)
+	else if (w_df > 0 && free_disk <= w_df)
 		result = STATE_WARNING;
 	else if (usp >= 0.0)
 		result = STATE_OK;
@@ -579,11 +510,92 @@ walk_name_list (struct name_list *list, const char *name)
 			/* if required for name_lists that have not saved w_df, etc (eg exclude lists) */
 			if (list->w_df) w_df = list->w_df;
 			if (list->c_df) c_df = list->c_df;
-			if (list->w_dfp) w_dfp = list->w_dfp;
-			if (list->c_dfp) c_dfp = list->c_dfp;
+			if (list->w_dfp>=0.0) w_dfp = list->w_dfp;
+			if (list->c_dfp>=0.0) c_dfp = list->c_dfp;
 			return TRUE;
 		}
 		list = list->name_next;
 	}
 	return FALSE;
 }
+
+
+
+
+
+
+void
+print_help (void)
+{
+	print_revision (progname, revision);
+
+	printf (_(COPYRIGHT), copyright, email);
+
+	printf (_("\
+This plugin checks the amount of used disk space on a mounted file system\n\
+and generates an alert if free space is less than one of the threshold values."));
+
+	print_usage ();
+
+	printf (_(UT_HELP_VRSN));
+
+	printf (_("\
+ -w, --warning=INTEGER\n\
+   Exit with WARNING status if less than INTEGER kilobytes of disk are free\n\
+ -w, --warning=PERCENT%%\n\
+   Exit with WARNING status if less than PERCENT of disk space is free\n\
+ -c, --critical=INTEGER\n\
+   Exit with CRITICAL status if less than INTEGER kilobytes of disk are free\n\
+ -c, --critical=PERCENT%%\n\
+   Exit with CRITCAL status if less than PERCENT of disk space is free\n\
+ -C, --clear\n\
+    Clear thresholds\n"));
+
+	printf (_("\
+ -u, --units=STRING\n\
+    Choose bytes, kB, MB, GB, TB (default: MB)\n\
+ -k, --kilobytes\n\
+    Same as '--units kB'\n\
+ -m, --megabytes\n\
+    Same as '--units MB'\n"));
+
+	printf (_("\
+ -l, --local\n\
+    Only check local filesystems\n\
+ -p, --path=PATH, --partition=PARTITION\n\
+    Path or partition (may be repeated)\n\
+ -x, --exclude_device=PATH <STRING>\n\
+    Ignore device (only works if -p unspecified)\n\
+ -X, --exclude-type=TYPE <STRING>\n\
+    Ignore all filesystems of indicated type (may be repeated)\n\
+ -M, --mountpoint\n\
+    Display the mountpoint instead of the partition\n\
+ -e, --errors-only\n\
+    Display only devices/mountpoints with errors\n"));
+
+	printf (_(UT_WARN_CRIT));
+
+	printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
+
+	printf (_(UT_VERBOSE));
+
+	printf ("%s", _("Examples:\n\
+ check_disk -w 10% -c 5% -p /tmp -p /var -C -w 100000 -c 50000 -p /\n\
+   Checks /tmp and /var at 10%,5% and / at 100MB, 50MB\n"));
+
+	support ();
+}
+
+
+
+
+void
+print_usage (void)
+{
+	printf (_("\
+Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e]\n\
+        [-v] [-q]\n\
+       %s (-h|--help)\n\
+       %s (-V|--version)\n"),
+	        progname,  progname, progname);
+}

+ 3 - 3
plugins/check_nt.c

@@ -65,7 +65,7 @@ const char *progname = "check_nt";
 
 int process_arguments(int, char **);
 void preparelist(char *string);
-int strtoularray(unsigned long *array, char *string, char *delim);
+int strtoularray(unsigned long *array, char *string, const char *delim);
 void print_help(void);
 void print_usage(void);
 
@@ -117,7 +117,7 @@ int main(int argc, char **argv){
 	else if(vars_to_check==CHECK_CPULOAD){
 
 		if (check_value_list==TRUE) {																			
-			if (strtoularray(&lvalue_list,value_list,",")==TRUE) {
+			if (strtoularray(lvalue_list,value_list,",")==TRUE) {
 				/* -l parameters is present with only integers */
 				return_code=STATE_OK;
 				asprintf(&temp_string,_("CPU Load"));
@@ -514,7 +514,7 @@ int process_arguments(int argc, char **argv){
 
 
 
-int strtoularray(unsigned long *array, char *string, char *delim) {
+int strtoularray(unsigned long *array, char *string, const char *delim) {
 	/* split a <delim> delimited string into a long array */
 	int idx=0;
 	char *t1;

+ 3 - 3
plugins/netutils.c

@@ -32,7 +32,7 @@
 #include "common.h"
 #include "netutils.h"
 
-int socket_timeout = DEFAULT_SOCKET_TIMEOUT; 
+unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; 
 int econn_refuse_state = STATE_CRITICAL;
 int was_refused = FALSE;
 int address_family = AF_UNSPEC;
@@ -131,7 +131,7 @@ process_tcp_request2 (char *server_address, int server_port,
 		else {											/* it has */
 			recv_result =
 				recv (sd, recv_buffer + recv_length, 
-					recv_size - recv_length - 1, 0);
+					(size_t)recv_size - recv_length - 1, 0);
 			if (recv_result == -1) {
 				/* recv failed, bail out */
 				strcpy (recv_buffer + recv_length, "");
@@ -201,7 +201,7 @@ process_request (char *server_address, int server_port, int proto,
 	}
 
 	else {
-		recv_result = recv (sd, recv_buffer, recv_size - 1, 0);
+		recv_result = recv (sd, recv_buffer, (size_t)recv_size - 1, 0);
 		if (recv_result == -1) {
 			strcpy (recv_buffer, "");
 			if (proto != IPPROTO_TCP)

+ 2 - 2
plugins/netutils.h

@@ -34,7 +34,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-RETSIGTYPE socket_timeout_alarm_handler (int);
+RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
 
 int process_tcp_request2 (char *address, int port, char *sbuffer,
 	char *rbuffer, int rsize);
@@ -58,7 +58,7 @@ int is_inet6_addr (char *);
 #endif
 int is_hostname (char *);
 
-extern int socket_timeout;
+extern unsigned int socket_timeout;
 extern int econn_refuse_state;
 extern int was_refused;
 extern int address_family;

+ 1 - 1
plugins/popen.h

@@ -2,7 +2,7 @@ FILE *spopen (const char *);
 int spclose (FILE *);
 RETSIGTYPE popen_timeout_alarm_handler (int);
 
-extern int timeout_interval;
+extern unsigned int timeout_interval;
 pid_t *childpid;
 int *child_stderr_array;
 FILE *child_process;

+ 8 - 8
plugins/utils.h

@@ -16,16 +16,16 @@ suite of plugins. */
 void support (void);
 char *clean_revstring (const char *revstring);
 void print_revision (const char *, const char *);
-void die (int result, const char *fmt, ...);
+void die (int result, const char *fmt, ...) __attribute__((noreturn));
 
 /* Handle timeouts */
 
 #ifdef LOCAL_TIMEOUT_ALARM_HANDLER
-extern int timeout_interval;
-RETSIGTYPE timeout_alarm_handler (int);
+extern unsigned int timeout_interval;
+RETSIGTYPE timeout_alarm_handler (int) __attribute__((noreturn));
 #else
-int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
-extern RETSIGTYPE timeout_alarm_handler (int);
+unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
+extern RETSIGTYPE timeout_alarm_handler (int) __attribute__((noreturn));
 #endif
 
 time_t start_time, end_time;
@@ -72,9 +72,9 @@ char *strpcat (char *dest, const char *src, const char *str);
 
 int max_state (int a, int b);
 
-void usage (char *msg);
-void usage2(char *msg, char *arg);
-void usage3(char *msg, char arg);
+void usage (char *msg) __attribute__((noreturn));
+void usage2(char *msg, char *arg) __attribute__((noreturn));
+void usage3(char *msg, char arg) __attribute__((noreturn));
 
 char *state_text (int result);