summaryrefslogtreecommitdiffstats
path: root/plugins/check_ntp.c
diff options
context:
space:
mode:
authorAnders Kaseorg <andersk@mit.edu>2012-06-29 00:57:48 -0400
committerHolger Weiss <holger@zedat.fu-berlin.de>2012-06-29 13:39:11 +0200
commit028d50d6f99e647a325a0a68303016382c4bbdc9 (patch)
tree1d9a14635602169d137409becfa108cd6bdb371c /plugins/check_ntp.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_ntp.c')
-rw-r--r--plugins/check_ntp.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c
index ac89def7..76d19ba3 100644
--- a/plugins/check_ntp.c
+++ b/plugins/check_ntp.c
@@ -800,28 +800,28 @@ int main(int argc, char *argv[]){
800 800
801 switch (result) { 801 switch (result) {
802 case STATE_CRITICAL : 802 case STATE_CRITICAL :
803 asprintf(&result_line, _("NTP CRITICAL:")); 803 xasprintf(&result_line, _("NTP CRITICAL:"));
804 break; 804 break;
805 case STATE_WARNING : 805 case STATE_WARNING :
806 asprintf(&result_line, _("NTP WARNING:")); 806 xasprintf(&result_line, _("NTP WARNING:"));
807 break; 807 break;
808 case STATE_OK : 808 case STATE_OK :
809 asprintf(&result_line, _("NTP OK:")); 809 xasprintf(&result_line, _("NTP OK:"));
810 break; 810 break;
811 default : 811 default :
812 asprintf(&result_line, _("NTP UNKNOWN:")); 812 xasprintf(&result_line, _("NTP UNKNOWN:"));
813 break; 813 break;
814 } 814 }
815 if(offset_result == STATE_UNKNOWN){ 815 if(offset_result == STATE_UNKNOWN){
816 asprintf(&result_line, "%s %s", result_line, _("Offset unknown")); 816 xasprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
817 asprintf(&perfdata_line, ""); 817 xasprintf(&perfdata_line, "");
818 } else { 818 } else {
819 asprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset); 819 xasprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset);
820 asprintf(&perfdata_line, "%s", perfd_offset(offset)); 820 xasprintf(&perfdata_line, "%s", perfd_offset(offset));
821 } 821 }
822 if (do_jitter) { 822 if (do_jitter) {
823 asprintf(&result_line, "%s, jitter=%f", result_line, jitter); 823 xasprintf(&result_line, "%s, jitter=%f", result_line, jitter);
824 asprintf(&perfdata_line, "%s %s", perfdata_line, perfd_jitter(jitter)); 824 xasprintf(&perfdata_line, "%s %s", perfdata_line, perfd_jitter(jitter));
825 } 825 }
826 printf("%s|%s\n", result_line, perfdata_line); 826 printf("%s|%s\n", result_line, perfdata_line);
827 827