journal-remote: update to 64bit µhttp api, provide fallback

64 bit offset is now accepted, which is nice. The old function is
deprecated, and generates a compile time warning when used. We only
use an offset of 0, so we really don't care. Adapt to use the new
function, but fall back to the old one on older versions.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2016-01-15 14:58:50 -05:00
parent ce7229a224
commit b3b0c23a56
2 changed files with 5 additions and 1 deletions

View file

@ -700,7 +700,7 @@ static int request_handler_file(
if (fstat(fd, &st) < 0)
return mhd_respondf(connection, MHD_HTTP_INTERNAL_SERVER_ERROR, "Failed to stat file: %m\n");
response = MHD_create_response_from_fd_at_offset(st.st_size, fd, 0);
response = MHD_create_response_from_fd_at_offset64(st.st_size, fd, MHD_VERSION);
if (!response)
return respond_oom(connection);

View file

@ -31,6 +31,10 @@
#define MHD_HTTP_NOT_ACCEPTABLE MHD_HTTP_METHOD_NOT_ACCEPTABLE
#endif
#if MHD_VERSION < 0x00094203
#define MHD_create_response_from_fd_at_offset64 MHD_create_response_from_fd_at_offset
#endif
void microhttpd_logger(void *arg, const char *fmt, va_list ap) _printf_(2, 0);
/* respond_oom() must be usable with return, hence this form. */