aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_swap.c
diff options
context:
space:
mode:
authorGravatar Anders Kaseorg <andersk@mit.edu> 2012-06-29 00:57:48 -0400
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2012-06-29 13:39:11 +0200
commit028d50d6f99e647a325a0a68303016382c4bbdc9 (patch)
tree1d9a14635602169d137409becfa108cd6bdb371c /plugins/check_swap.c
parent9976876584e5a1df6e1c9315212c3d274df7a12e (diff)
downloadmonitoring-plugins-028d50d6f99e647a325a0a68303016382c4bbdc9.tar.gz
Die when asprintf fails
Fixes many instances of warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Diffstat (limited to 'plugins/check_swap.c')
-rw-r--r--plugins/check_swap.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index ce1f6022..1b2a8dd5 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -129,7 +129,7 @@ main (int argc, char **argv)
percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
result = max_state (result, check_swap (percent, dskfree_mb));
if (verbose)
- asprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
+ xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
}
}
else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFre]%*[:] %f %*[k]%*[B]", str, &tmp_mb)) {
@@ -152,15 +152,15 @@ main (int argc, char **argv)
free_swap_mb = dskfree_mb;
#else
# ifdef HAVE_SWAP
- asprintf(&swap_command, "%s", SWAP_COMMAND);
- asprintf(&swap_format, "%s", SWAP_FORMAT);
+ xasprintf(&swap_command, "%s", SWAP_COMMAND);
+ xasprintf(&swap_format, "%s", SWAP_FORMAT);
/* These override the command used if a summary (and thus ! allswaps) is required */
/* The summary flag returns more accurate information about swap usage on these OSes */
# ifdef _AIX
if (!allswaps) {
- asprintf(&swap_command, "%s", "/usr/sbin/lsps -s");
- asprintf(&swap_format, "%s", "%f%*s %f");
+ xasprintf(&swap_command, "%s", "/usr/sbin/lsps -s");
+ xasprintf(&swap_format, "%s", "%f%*s %f");
conv_factor = 1;
}
# endif
@@ -228,7 +228,7 @@ main (int argc, char **argv)
percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
result = max_state (result, check_swap (percent, dskfree_mb));
if (verbose)
- asprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
+ xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
}
}
# ifdef _AIX
@@ -290,7 +290,7 @@ main (int argc, char **argv)
percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
result = max_state (result, check_swap (percent, dskfree_mb));
if (verbose) {
- asprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
+ xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
}
}
@@ -329,7 +329,7 @@ main (int argc, char **argv)
percent = 100 * (((double) dskused_mb) / ((double) dsktotal_mb));
result = max_state (result, check_swap (percent, dskfree_mb));
if (verbose) {
- asprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
+ xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent);
}
}