commit b315ec7108c0a742fd1c0f365d27bd70a42ab2e9 parent c121b9c1758c30446da2ea2556a8c3c2991053e4 Author: Rafael Garcia <rafael.garcia.gallego@gmail.com> Date: Mon, 6 Jun 2011 17:39:16 +0200 Fix reading stdin instead of a file. Diffstat:
sandy.c | | | 7 | ++++++- |
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sandy.c b/sandy.c @@ -1082,7 +1082,12 @@ i_readfile(char *fname) { fcur=i_addtext(buf, fcur); } if(fd > 0) close(fd); - else reset_prog_mode(); + else { + if((fd = open("/dev/tty", O_RDONLY)) == -1) i_die("Can't reopen stdin.\n"); + dup2(fd, 0); + close(fd); + reset_prog_mode(); + } free(buf); fcur.l=fstline; fcur.o=0;