Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 81f3331

Browse files
committed
(tty_flush_winch): return boolean.
Return TRUE if at least one SIGWINCH flag was read from pipe. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
1 parent a493aa9 commit 81f3331

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/tty/tty.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,11 @@ tty_got_winch (void)
216216

217217
/* --------------------------------------------------------------------------------------------- */
218218

219-
void
219+
gboolean
220220
tty_flush_winch (void)
221221
{
222222
ssize_t n;
223+
gboolean ret = FALSE;
223224

224225
/* merge all SIGWINCH events raised to this moment */
225226
do
@@ -228,8 +229,14 @@ tty_flush_winch (void)
228229

229230
/* read multiple events at a time */
230231
n = read (sigwinch_pipe[0], &x, sizeof (x));
232+
233+
/* at least one SIGWINCH came */
234+
if (n > 0)
235+
ret = TRUE;
231236
}
232237
while (n > 0 || (n == -1 && errno == EINTR));
238+
239+
return ret;
233240
}
234241

235242
/* --------------------------------------------------------------------------------------------- */

lib/tty/tty.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ extern void tty_disable_interrupt_key (void);
8181
extern gboolean tty_got_interrupt (void);
8282

8383
extern gboolean tty_got_winch (void);
84-
extern void tty_flush_winch (void);
84+
extern gboolean tty_flush_winch (void);
8585

8686
extern void tty_reset_prog_mode (void);
8787
extern void tty_reset_shell_mode (void);

0 commit comments

Comments
 (0)