summaryrefslogtreecommitdiffstats
path: root/plugins/check_ntp_time.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_time.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_time.c')
-rw-r--r--plugins/check_ntp_time.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c
index f0f74b4e..d543d6b5 100644
--- a/plugins/check_ntp_time.c
+++ b/plugins/check_ntp_time.c
@@ -564,24 +564,24 @@ int main(int argc, char *argv[]){
564 564
565 switch (result) { 565 switch (result) {
566 case STATE_CRITICAL : 566 case STATE_CRITICAL :
567 asprintf(&result_line, _("NTP CRITICAL:")); 567 xasprintf(&result_line, _("NTP CRITICAL:"));
568 break; 568 break;
569 case STATE_WARNING : 569 case STATE_WARNING :
570 asprintf(&result_line, _("NTP WARNING:")); 570 xasprintf(&result_line, _("NTP WARNING:"));
571 break; 571 break;
572 case STATE_OK : 572 case STATE_OK :
573 asprintf(&result_line, _("NTP OK:")); 573 xasprintf(&result_line, _("NTP OK:"));
574 break; 574 break;
575 default : 575 default :
576 asprintf(&result_line, _("NTP UNKNOWN:")); 576 xasprintf(&result_line, _("NTP UNKNOWN:"));
577 break; 577 break;
578 } 578 }
579 if(offset_result == STATE_UNKNOWN){ 579 if(offset_result == STATE_UNKNOWN){
580 asprintf(&result_line, "%s %s", result_line, _("Offset unknown")); 580 xasprintf(&result_line, "%s %s", result_line, _("Offset unknown"));
581 asprintf(&perfdata_line, ""); 581 xasprintf(&perfdata_line, "");
582 } else { 582 } else {
583 asprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset); 583 xasprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset);
584 asprintf(&perfdata_line, "%s", perfd_offset(offset)); 584 xasprintf(&perfdata_line, "%s", perfd_offset(offset));
585 } 585 }
586 printf("%s|%s\n", result_line, perfdata_line); 586 printf("%s|%s\n", result_line, perfdata_line);
587 587