From c25cf5a0561db8383bc9b24f0f6d30e8e802bd80 Mon Sep 17 00:00:00 2001 From: Jan Kneschke Date: Mon, 8 Aug 2005 09:48:38 +0000 Subject: [PATCH] O_BINARY for cygwin, volatile for sig_atomic_t (merged [286], [287]) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@505 152afb58-edef-0310-8abb-c4023f1b3aa9 --- src/base.h | 4 ++++ src/mod_compress.c | 6 +++--- src/server.c | 6 +++--- src/stream.c | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/base.h b/src/base.h index 0eef3683..197e49f7 100644 --- a/src/base.h +++ b/src/base.h @@ -34,6 +34,10 @@ # include #endif +#ifndef O_BINARY +# define O_BINARY 0 +#endif + #ifndef O_LARGEFILE # define O_LARGEFILE 0 #endif diff --git a/src/mod_compress.c b/src/mod_compress.c index 19d42134..a5ffc673 100644 --- a/src/mod_compress.c +++ b/src/mod_compress.c @@ -383,7 +383,7 @@ static int deflate_file_to_file(server *srv, connection *con, plugin_data *p, bu buffer_append_string_buffer(p->ofn, sce->etag); - if (-1 == (ofd = open(p->ofn->ptr, O_WRONLY | O_CREAT | O_EXCL, 0600))) { + if (-1 == (ofd = open(p->ofn->ptr, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0600))) { if (errno == EEXIST) { /* cache-entry exists */ #if 0 @@ -401,7 +401,7 @@ static int deflate_file_to_file(server *srv, connection *con, plugin_data *p, bu #if 0 log_error_write(srv, __FILE__, __LINE__, "bs", p->ofn, "compress-cache miss"); #endif - if (-1 == (ifd = open(filename, O_RDONLY))) { + if (-1 == (ifd = open(filename, O_RDONLY | O_BINARY))) { log_error_write(srv, __FILE__, __LINE__, "sbss", "opening plain-file", fn, "failed", strerror(errno)); close(ofd); @@ -473,7 +473,7 @@ static int deflate_file_to_buffer(server *srv, connection *con, plugin_data *p, if (sce->st.st_size > SIZE_MAX) return -1; - if (-1 == (ifd = open(fn->ptr, O_RDONLY))) { + if (-1 == (ifd = open(fn->ptr, O_RDONLY | O_BINARY))) { log_error_write(srv, __FILE__, __LINE__, "sbss", "opening plain-file", fn, "failed", strerror(errno)); return -1; diff --git a/src/server.c b/src/server.c index f761fe7e..606a8ef2 100644 --- a/src/server.c +++ b/src/server.c @@ -58,9 +58,9 @@ const char *patches[] = { "SERVERsocket", "HTTPurl", "HTTPhost", "HTTPreferer", /* #define USE_ALARM */ #endif -static sig_atomic_t srv_shutdown = 0; -static sig_atomic_t handle_sig_alarm = 1; -static sig_atomic_t handle_sig_hup = 0; +static volatile sig_atomic_t srv_shutdown = 0; +static volatile sig_atomic_t handle_sig_alarm = 1; +static volatile sig_atomic_t handle_sig_hup = 0; #if defined(HAVE_SIGACTION) && defined(SA_SIGINFO) static void sigaction_handler(int sig, siginfo_t *si, void *context) { diff --git a/src/stream.c b/src/stream.c index ec228d85..bdfcc334 100644 --- a/src/stream.c +++ b/src/stream.c @@ -27,7 +27,7 @@ int stream_open(stream *f, buffer *fn) { f->size = st.st_size; #ifdef HAVE_MMAP - if (-1 == (fd = open(fn->ptr, O_RDONLY))) { + if (-1 == (fd = open(fn->ptr, O_RDONLY | O_BINARY))) { return -1; }