output: check alarming mode can output successfully

Fixes also a resource leak.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2016-04-24 12:29:50 +01:00
parent f6e256243d
commit a3ef3d617f
No known key found for this signature in database
GPG key ID: A9553245FDE9B739

View file

@ -1002,9 +1002,13 @@ int output_alarming(void)
} else {
if (config.number_limit & A_BIT)
fprintf(outfile, "OK:");
else
else {
if (close_stream(outfile)) {
error(EXIT_FAILURE, errno, "output_alarming: fclose");
}
return ret_val;
}
}
if (config.header_limit & R_BIT) {
fprintf(outfile, " Ranges - crit: %d warn: %d ok: %d", rc, rw, ro);
if (ri != 0) {