summaryrefslogtreecommitdiff
path: root/misc/dialog/patches/patch-aa
blob: 7becff8e6bfc9768dbebaabc611951c3014f9222 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$NetBSD: patch-aa,v 1.13 2005/11/08 18:05:23 reed Exp $

--- util.c.orig	2005-10-30 12:15:17.000000000 -0800
+++ util.c	2005-10-31 15:55:28.000000000 -0800
@@ -264,7 +264,8 @@
 	if ((fd1 = open_terminal(&device, O_RDONLY)) >= 0
 	    && (fd2 = dup(fileno(stdin))) >= 0) {
 	    dialog_state.pipe_input = fdopen(fd2, "r");
-	    *stdin = *freopen(device, "r", stdin);
+	    if (freopen(device, "r", stdin) == 0)
+		dlg_exiterr("cannot open tty-input");
 	    if (fileno(stdin) != 0)	/* some functions may read fd #0 */
 		(void) dup2(fileno(stdin), 0);
 	}