From: Todd C. Miller Date: Sun, 27 Sep 2009 22:12:45 +0000 (+0000) Subject: When copying the terminal attributes to the pty, be sure not to set ONLCR. X-Git-Tag: SUDO_1_7_3~257 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=929f13fdfcb537c0fa2e17cb94058ae90072bce6;p=sudo When copying the terminal attributes to the pty, be sure not to set ONLCR. This prevents extra carriage returns from ending up in the script output file. --- diff --git a/term.c b/term.c index 92f381291..ca86c607c 100644 --- a/term.c +++ b/term.c @@ -191,6 +191,8 @@ term_copy(src, dst) if (tcgetattr(src, &tt) != 0) return(0); + /* Do not convert line endings from NL to NLCR. */ + CRL(tt.c_oflag, ONLCR); if (tcsetattr(dst, TCSAFLUSH, &tt) != 0) return(0); return(1); @@ -249,6 +251,8 @@ term_copy(src, dst) ioctl(src, TIOCLGET, &lb)) { return(0); } + /* Do not convert line endings from NL to NLCR. */ + CLR(b.sg_flags, CRMOD); if (ioctl(dst, TIOCSETP, &b) != 0 || ioctl(dst, TIOCSETC, &tc) != 0 || ioctl(dst, TIOCSLTC, &lc) != 0 || ioctl(dst, TIOCLSET, &lb) != 0 || ioctl(dst, TIOCSETD, &l) != 0) {