make debugfs exit on sigpipe (#16569)
* debugfs exit on sigpipe * return 1 on sigpipe
Ilya Mashchenko committed
Dec 8, 2023 at 11:34 UTC
687b19fa397777498c332d8d0f8f33365286edf8
1 file changed
+7
collectors/debugfs.plugin/debugfs_plugin.c
+7
@@ -235,6 +235,13 @@ int main(int argc, char **argv)
235
netdata_log_info("all modules are disabled, exiting...");
236
return 1;
237
}
238
+
239
+ fprintf(stdout, "\n");
240
+ fflush(stdout);
241
+ if (ferror(stdout) && errno == EPIPE) {
242
+ netdata_log_error("error writing to stdout: EPIPE. Exiting...");
243
+ return 1;
244
+ }
245
}
246
247
fprintf(stdout, "EXIT\n");