[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] mi: Make sure fd is non-blocking before select+read.
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH] mi: Make sure fd is non-blocking before select+read. |
Date: |
Tue, 12 May 2020 18:47:01 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
if (pk_mi_exit_p)
- /* Client requested us to close the connection. */
- return 1;
+ {
+ /* Client requested us to close the connection. */
+ pk_mi_fd_restore_blocking (fd, old_flags);
+ return 1;
+ }
else if (ret == -1)
- /* Client closed the connection. */
- return 1;
+ {
+ /* Client closed the connection. */
+ pk_mi_fd_restore_blocking (fd, old_flags);
+ return 1;
+ }
else if (ret == -2)
- /* Protocol error. */
- return 0;
+ {
+ /* Protocol error. */
+ pk_mi_fd_restore_blocking (fd, old_flags);
+ return 0;
+ }
}
}
}
Isn't setting `ret' and then breaking out of the loop enough for these
alternatives?