diff --git a/NEWS b/NEWS index deea305d..01f3a1b7 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ NEWS * force assertion: setting FD_CLOEXEC must work (if available) * [network] check return value of lseek() * fix unchecked return values from stream_open/stat_cache_get_entry + * [mod_webdav] fix logic error in handling file creation error - 1.4.34 * [mod_auth] explicitly link ssl for SHA1 (fixes #2517) diff --git a/src/mod_webdav.c b/src/mod_webdav.c index a7ec31fe..04b21616 100644 --- a/src/mod_webdav.c +++ b/src/mod_webdav.c @@ -1690,7 +1690,7 @@ URIHANDLER_FUNC(mod_webdav_subrequest_handler) { /* if the file doesn't exist, create it */ if (-1 == (fd = open(con->physical.path->ptr, O_WRONLY|O_TRUNC, WEBDAV_FILE_MODE))) { - if (errno == ENOENT && + if (errno != ENOENT || -1 == (fd = open(con->physical.path->ptr, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, WEBDAV_FILE_MODE))) { /* we can't open the file */ con->http_status = 403;