client: Simplify input EOF handling
We increment @send_eof only when read() returns zero, and we read()
only when it's zero. Therefore, we never increment it beyond one.
Change it from counter to flag.
This effectively reverts commit 51846ec
(v4.3.11). Possible only
because the previous commit got rid of the @send_eof increment on
failed execute.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
b6d0f4e3db
commit
3135cd39c3
1 changed files with 3 additions and 3 deletions
|
@ -508,7 +508,7 @@ play(int sock)
|
||||||
partial_line_sent = 0;
|
partial_line_sent = 0;
|
||||||
if (send_eof && !partial_line_sent
|
if (send_eof && !partial_line_sent
|
||||||
&& ring_putm(&inbuf, EOF_COOKIE, sizeof(EOF_COOKIE) - 1) >= 0)
|
&& ring_putm(&inbuf, EOF_COOKIE, sizeof(EOF_COOKIE) - 1) >= 0)
|
||||||
send_eof--;
|
send_eof = 0;
|
||||||
if (send_intr && !partial_line_sent
|
if (send_intr && !partial_line_sent
|
||||||
&& ring_putm(&inbuf, INTR_COOKIE, sizeof(INTR_COOKIE) - 1) >= 0) {
|
&& ring_putm(&inbuf, INTR_COOKIE, sizeof(INTR_COOKIE) - 1) >= 0) {
|
||||||
send_intr = 0;
|
send_intr = 0;
|
||||||
|
@ -532,14 +532,14 @@ play(int sock)
|
||||||
perror("read batch file");
|
perror("read batch file");
|
||||||
send_intr = 1;
|
send_intr = 1;
|
||||||
} else
|
} else
|
||||||
send_eof++;
|
send_eof = 1;
|
||||||
close(input_fd);
|
close(input_fd);
|
||||||
input_fd = 0;
|
input_fd = 0;
|
||||||
} else {
|
} else {
|
||||||
/* stop reading input, drain socket ring buffers */
|
/* stop reading input, drain socket ring buffers */
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
perror("read stdin");
|
perror("read stdin");
|
||||||
send_eof++;
|
send_eof = 1;
|
||||||
eof_fd0 = 1;
|
eof_fd0 = 1;
|
||||||
sa.sa_handler = SIG_DFL;
|
sa.sa_handler = SIG_DFL;
|
||||||
sigaction(SIGINT, &sa, NULL);
|
sigaction(SIGINT, &sa, NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue