idup() -> dup2() - st - Simple Terminal Err gopher.r-36.net 70 i Err gopher.r-36.net 70 1Log /scm/st//log.gph gopher.r-36.net 70 1Files /scm/st//files.gph gopher.r-36.net 70 1Refs /scm/st//refs.gph gopher.r-36.net 70 1README /scm/st//file/README.gph gopher.r-36.net 70 1LICENSE /scm/st//file/LICENSE.gph gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1commit 20d53cebc122829449524ef339ce44e13c6e85ec /scm/st//commit/20d53cebc122829449524ef339ce44e13c6e85ec.gph gopher.r-36.net 70 1parent bf8c71e42937b623f76ced22c9557f87e3d945da /scm/st//commit/bf8c71e42937b623f76ced22c9557f87e3d945da.gph gopher.r-36.net 70 hAuthor: FRIGN URL:mailto:dev@frign.de gopher.r-36.net 70 iDate: Tue, 22 Sep 2015 13:13:25 +0200 Err gopher.r-36.net 70 i Err gopher.r-36.net 70 idup() -> dup2() Err gopher.r-36.net 70 i Err gopher.r-36.net 70 igcc would warn about an unused result. We know it is 0 and dup() Err gopher.r-36.net 70 ican't fail in these circumstances, as we closed fd0 previously. Err gopher.r-36.net 70 iUsing dup2() to do the same saves one line and shuts gcc up, bringing Err gopher.r-36.net 70 ius a clean build back. Err gopher.r-36.net 70 i Err gopher.r-36.net 70 iDiffstat: Err gopher.r-36.net 70 i st.c | 3 +-- Err gopher.r-36.net 70 i Err gopher.r-36.net 70 i1 file changed, 1 insertion(+), 2 deletions(-) Err gopher.r-36.net 70 i--- Err gopher.r-36.net 70 1diff --git a/st.c b/st.c /scm/st//file/st.c.gph gopher.r-36.net 70 i@@ -1430,8 +1430,7 @@ ttynew(void) Err gopher.r-36.net 70 i if (opt_line) { Err gopher.r-36.net 70 i if ((cmdfd = open(opt_line, O_RDWR)) < 0) Err gopher.r-36.net 70 i die("open line failed: %s\n", strerror(errno)); Err gopher.r-36.net 70 i- close(0); Err gopher.r-36.net 70 i- dup(cmdfd); Err gopher.r-36.net 70 i+ dup2(cmdfd, 0); Err gopher.r-36.net 70 i stty(); Err gopher.r-36.net 70 i return; Err gopher.r-36.net 70 i } Err gopher.r-36.net 70 .