st
simple terminal
git clone https://9o.is/git/st.git
commit 5bf7c6a26d84a0fbd5242a1af754535cd05b7cd5 parent a368aba73caeb98893359c116e46a1b274feef58 Author: FRIGN <dev@frign.de> Date: Tue, 22 Sep 2015 13:13:25 +0200 dup() -> dup2() gcc would warn about an unused result. We know it is 0 and dup() can't fail in these circumstances, as we closed fd0 previously. Using dup2() to do the same saves one line and shuts gcc up, bringing us a clean build back. Diffstat:
| M | st.c | | | 3 | +-- |
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/st.c b/st.c @@ -1430,8 +1430,7 @@ ttynew(void) if (opt_line) { if ((cmdfd = open(opt_line, O_RDWR)) < 0) die("open line failed: %s\n", strerror(errno)); - close(0); - dup(cmdfd); + dup2(cmdfd, 0); stty(); return; }