From e6f606748a384c5681985ec063f976520e93156a Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 24 Jul 2006 23:35:41 +0200 Subject: [PATCH] Check the value returned by fopen() during display initialization 12:12 < kahmalo> Opening /dev/tty may fail; what does newterm do then? 20:15 < Miciah> fonseca: You always gotta check the return value of fopen. Silly head. --- tig.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tig.c b/tig.c index 8bae0d5..6a1f3d1 100644 --- a/tig.c +++ b/tig.c @@ -2583,6 +2583,8 @@ init_display(void) /* Leave stdin and stdout alone when acting as a pager. */ FILE *io = fopen("/dev/tty", "r+"); + if (!io) + die("Failed to open /dev/tty"); cursed = !!newterm(NULL, io, io); } -- 2.32.0.93.g670b81a890