Skip to content

Commit

Permalink
Doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
gwsw committed May 29, 2023
1 parent c8df315 commit 883fc6c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

Major changes between "less" versions 633 and 634

* Fix problem when a program piping into less reads from the tty,
like sudo asking for password (github #368).

* Fix search modifier ^E after ^W.

======================================================================
Expand Down
12 changes: 7 additions & 5 deletions os.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,14 @@ static int check_poll(int fd, int tty)
struct pollfd poller[2] = { { fd, POLLIN, 0 }, { tty, POLLIN, 0 } };
int timeout = (waiting_for_data && !(scanning_eof && follow_mode == FOLLOW_NAME)) ? -1 : waiting_for_data_delay;
if (!any_data)
{
/*
* Don't do polling if no data has yet been received,
* to allow a program piping data into less to have temporary
* access to the tty (like sudo asking for a password).
*/
return (0);
}
poll(poller, 2, timeout);
#if LESSTEST
if (ttyin_name == NULL) /* Check for ^X only on a real tty. */
Expand All @@ -133,11 +140,6 @@ static int check_poll(int fd, int tty)
if (ignore_eoi && exit_F_on_close && (poller[0].revents & (POLLHUP|POLLIN)) == POLLHUP)
/* Break out of F loop on HUP due to --exit-follow-on-close. */
return (READ_INTR);
/*
* Don't return READ_AGAIN if no data has yet been received,
* to allow a program piping data into less to have temporary
* access to the tty (like sudo asking for a password).
*/
if ((poller[0].revents & (POLLIN|POLLHUP|POLLERR)) == 0)
/* No data available; let caller take action, then try again. */
return (READ_AGAIN);
Expand Down
3 changes: 2 additions & 1 deletion version.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,8 @@ v630 3/18/23 Add LESS_DATA_DELAY.
v631 3/26/23 Fix input of dead keys on Windows.
v632 4/6/23 Make lesstest work on MacOS; minor fixes.
v633 5/3/23 Fix build on systems with ncurses/termcap.h or ncursesw/termcap.h.
v634
v634 Allow program piping into less to access tty;
fix search modifier ^E after ^W.
*/

char version[] = "634x";

0 comments on commit 883fc6c

Please sign in to comment.