From bebde6950729b550a59a85adb435db289148a7d5 Mon Sep 17 00:00:00 2001 From: witekfl Date: Fri, 25 May 2012 16:13:25 +0200 Subject: [PATCH] Compilation fixes for Mingw32. * check if fork is available * use set_nonblocking_fd --- configure.in | 2 ++ src/protocol/file/file.c | 3 ++- src/protocol/file/mailcap.c | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 013050f5..d0f5749a 100644 --- a/configure.in +++ b/configure.in @@ -295,6 +295,8 @@ AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=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. # I've no idea about their historical background, but I keep them here # just in the case they will help later. --pasky diff --git a/src/protocol/file/file.c b/src/protocol/file/file.c index b35b77ce..f7ff57b3 100644 --- a/src/protocol/file/file.c +++ b/src/protocol/file/file.c @@ -264,12 +264,13 @@ file_protocol_handler(struct connection *connection) /* Treat /dev/stdin in special way */ 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) { abort_connection(connection, connection_state(-errno)); return; } + set_nonblocking_fd(fd); if (!init_http_connection_info(connection, 1, 0, 1)) { abort_connection(connection, connection_state(S_OUT_OF_MEM)); close(fd); diff --git a/src/protocol/file/mailcap.c b/src/protocol/file/mailcap.c index f64348bb..7e1c4301 100644 --- a/src/protocol/file/mailcap.c +++ b/src/protocol/file/mailcap.c @@ -46,6 +46,7 @@ struct module mailcap_protocol_module = struct_module( /* done: */ NULL ); +#ifdef HAVE_FORK static void get_request(struct connection *conn) { @@ -63,10 +64,12 @@ get_request(struct connection *conn) read_from_socket(conn->socket, rb, connection_state(S_SENT), http_got_header); } +#endif void mailcap_protocol_handler(struct connection *conn) { +#ifdef HAVE_FORK unsigned char *script, *ref; pid_t pid; struct connection_state state = connection_state(S_OK); @@ -137,6 +140,7 @@ end1: end2: abort_connection(conn, state); return; +#endif bad: abort_connection(conn, connection_state(S_BAD_URL)); }