summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-30 00:25:03 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-08-30 00:25:03 +0200
commit2dcfb6a35862817c529229cd9d73ac89815ea662 (patch)
tree65c6448a1bd4a476780f2de6f82240e793f8c86d
parent11efcafb3372777ee3e416c145047707d9d228dd (diff)
libdiskfs: Avoid crashing when stdout/err shuts downv0.9.git20220830
stdout/err could shut down for whatever reason (killed the term on /dev/console or whatever). We should not crash just because we lost our ability to print output.
-rw-r--r--libdiskfs/console.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libdiskfs/console.c b/libdiskfs/console.c
index 74715b8b..1698f633 100644
--- a/libdiskfs/console.c
+++ b/libdiskfs/console.c
@@ -68,4 +68,8 @@ diskfs_console_stdio ()
stdout = stderr = mach_open_devstream (cons, "w");
mach_port_deallocate (mach_task_self (), cons);
}
+
+ /* And make sure we don't die just because we got some error there. */
+ signal (SIGPIPE, SIG_IGN);
+ signal (SIGLOST, SIG_IGN);
}