1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-30 01:55:30 +00:00

Allow empty /dev/stdin

For example: PAGER=elinks git diff
shows nothing, when repo is not dirty.
This commit is contained in:
Witold Filipczyk 2010-07-31 21:48:48 +02:00 committed by Witold Filipczyk
parent a27e7d95ee
commit cbf5ef6680

View File

@ -207,6 +207,16 @@ list_directory(struct connection *conn, unsigned char *dirpath,
return connection_state(S_OK);
}
static void
check_if_closed(struct socket *socket, struct read_buffer *rb)
{
if (socket->state == SOCKET_CLOSED) {
abort_connection(socket->conn, connection_state(S_OK));
return;
}
http_got_header(socket, rb);
}
static void
read_from_stdin(struct connection *conn)
{
@ -222,7 +232,7 @@ read_from_stdin(struct connection *conn)
conn->socket->state = SOCKET_END_ONCLOSE;
read_from_socket(conn->socket, rb, connection_state(S_SENT),
http_got_header);
check_if_closed);
}
/* To reduce redundant error handling code [calls to abort_connection()]