Browse Source

[mod_webdav] fix logic error in handling file creation error

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2955 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.35
Stefan Bühler 8 years ago
parent
commit
8e31e18b8e
  1. 1
      NEWS
  2. 2
      src/mod_webdav.c

1
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)

2
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;

Loading…
Cancel
Save