Browse Source

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.
master
FRIGN 9 years ago
parent
commit
20d53cebc1
1 changed files with 1 additions and 2 deletions
  1. +1
    -2
      st.c

+ 1
- 2
st.c View File

@ -1430,8 +1430,7 @@ ttynew(void)
if (opt_line) { if (opt_line) {
if ((cmdfd = open(opt_line, O_RDWR)) < 0) if ((cmdfd = open(opt_line, O_RDWR)) < 0)
die("open line failed: %s\n", strerror(errno)); die("open line failed: %s\n", strerror(errno));
close(0);
dup(cmdfd);
dup2(cmdfd, 0);
stty(); stty();
return; return;
} }


Loading…
Cancel
Save