From 8e31e18b8e983ed54141cb872280c545ac0cfc83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Sun, 16 Feb 2014 13:08:36 +0000 Subject: [PATCH] [mod_webdav] fix logic error in handling file creation error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Stefan Bühler git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2955 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/mod_webdav.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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;