diff options
author | 2013-12-12 22:59:25 +0000 | |
---|---|---|
committer | 2013-12-12 22:59:25 +0000 | |
commit | b59cbc442a9d0e0b6865f19d083126978261f87d (patch) | |
tree | a0b70a30c12e497f17c088ba36e6142f0e3b59ba | |
parent | POSIX no longer requires sys/types.h be included to get the pid_t (diff) | |
download | wireguard-openbsd-b59cbc442a9d0e0b6865f19d083126978261f87d.tar.xz wireguard-openbsd-b59cbc442a9d0e0b6865f19d083126978261f87d.zip |
handle ttysize/TIOCGSIZE as a fallback for winsize/TIOCGWINSZ, not the
other way around; ok millert@
-rw-r--r-- | usr.bin/sudo/lbuf.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/sudo/lbuf.c b/usr.bin/sudo/lbuf.c index 5f9d766d89c..fde63c41643 100644 --- a/usr.bin/sudo/lbuf.c +++ b/usr.bin/sudo/lbuf.c @@ -52,10 +52,10 @@ #include "sudo.h" #include "lbuf.h" -#if !defined(TIOCGSIZE) && defined(TIOCGWINSZ) -# define TIOCGSIZE TIOCGWINSZ -# define ttysize winsize -# define ts_cols ws_col +#if !defined(TIOCGWINSZ) && defined(TIOCGSIZE) +# define TIOCGWINSZ TIOCGSIZE +# define winsize ttysize +# define ws_col ts_cols #endif int @@ -64,10 +64,10 @@ get_ttycols() char *p; int cols; #ifdef TIOCGSIZE - struct ttysize win; + struct winsize win; - if (ioctl(STDERR_FILENO, TIOCGSIZE, &win) == 0 && win.ts_cols != 0) - return((int)win.ts_cols); + if (ioctl(STDERR_FILENO, TIOCGWINSZ, &win) == 0 && win.ws_col != 0) + return((int)win.ws_col); #endif /* Fall back on $COLUMNS. */ |