mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
Compilation fixes for Mingw32.
* check if fork is available * use set_nonblocking_fd
This commit is contained in:
parent
5f9b54f594
commit
bebde69507
@ -295,6 +295,8 @@ AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
|
|||||||
|
|
||||||
AC_CHECK_FUNCS(wcwidth, HAVE_WCWIDTH=yes)
|
AC_CHECK_FUNCS(wcwidth, HAVE_WCWIDTH=yes)
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS(fork)
|
||||||
|
|
||||||
# These aren't probably needed now, as they are commented in links.h.
|
# These aren't probably needed now, as they are commented in links.h.
|
||||||
# I've no idea about their historical background, but I keep them here
|
# I've no idea about their historical background, but I keep them here
|
||||||
# just in the case they will help later. --pasky
|
# just in the case they will help later. --pasky
|
||||||
|
@ -264,12 +264,13 @@ file_protocol_handler(struct connection *connection)
|
|||||||
|
|
||||||
/* Treat /dev/stdin in special way */
|
/* Treat /dev/stdin in special way */
|
||||||
if (!strcmp(connection->uri->string, "file:///dev/stdin")) {
|
if (!strcmp(connection->uri->string, "file:///dev/stdin")) {
|
||||||
int fd = open("/dev/stdin", O_RDONLY | O_NONBLOCK);
|
int fd = open("/dev/stdin", O_RDONLY);
|
||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
abort_connection(connection, connection_state(-errno));
|
abort_connection(connection, connection_state(-errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
set_nonblocking_fd(fd);
|
||||||
if (!init_http_connection_info(connection, 1, 0, 1)) {
|
if (!init_http_connection_info(connection, 1, 0, 1)) {
|
||||||
abort_connection(connection, connection_state(S_OUT_OF_MEM));
|
abort_connection(connection, connection_state(S_OUT_OF_MEM));
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -46,6 +46,7 @@ struct module mailcap_protocol_module = struct_module(
|
|||||||
/* done: */ NULL
|
/* done: */ NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef HAVE_FORK
|
||||||
static void
|
static void
|
||||||
get_request(struct connection *conn)
|
get_request(struct connection *conn)
|
||||||
{
|
{
|
||||||
@ -63,10 +64,12 @@ get_request(struct connection *conn)
|
|||||||
read_from_socket(conn->socket, rb, connection_state(S_SENT),
|
read_from_socket(conn->socket, rb, connection_state(S_SENT),
|
||||||
http_got_header);
|
http_got_header);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
mailcap_protocol_handler(struct connection *conn)
|
mailcap_protocol_handler(struct connection *conn)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_FORK
|
||||||
unsigned char *script, *ref;
|
unsigned char *script, *ref;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
struct connection_state state = connection_state(S_OK);
|
struct connection_state state = connection_state(S_OK);
|
||||||
@ -137,6 +140,7 @@ end1:
|
|||||||
end2:
|
end2:
|
||||||
abort_connection(conn, state);
|
abort_connection(conn, state);
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
bad:
|
bad:
|
||||||
abort_connection(conn, connection_state(S_BAD_URL));
|
abort_connection(conn, connection_state(S_BAD_URL));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user