We should use the fd specified by caller.
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
}
/* Get current termios */
- if (tcgetattr(0, oldtios)) {
+ if (tcgetattr(fd, oldtios)) {
SYSERROR("failed to get current terminal settings");
return -1;
}
newtios->c_cc[VTIME] = 0;
/* Set new attributes */
- if (tcsetattr(0, TCSAFLUSH, newtios)) {
+ if (tcsetattr(fd, TCSAFLUSH, newtios)) {
ERROR("failed to set new terminal settings");
return -1;
}