--- embedaddon/lighttpd/src/mod_webdav.c 2013/10/14 10:32:47 1.1.1.1 +++ embedaddon/lighttpd/src/mod_webdav.c 2014/06/15 20:20:06 1.1.1.2 @@ -179,7 +179,7 @@ SETDEFAULTS_FUNC(mod_webdav_set_defaults) { if (!p) return HANDLER_ERROR; - p->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *)); + p->config_storage = calloc(1, srv->config_context->used * sizeof(plugin_config *)); for (i = 0; i < srv->config_context->used; i++) { plugin_config *s; @@ -1258,7 +1258,7 @@ URIHANDLER_FUNC(mod_webdav_subrequest_handler) { if (1 == webdav_parse_chunkqueue(srv, con, p, con->request_content_queue, &xml)) { xmlNode *rootnode = xmlDocGetRootElement(xml); - assert(rootnode); + force_assert(rootnode); if (0 == xmlStrcmp(rootnode->name, BAD_CAST "propfind")) { xmlNode *cmd; @@ -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; @@ -1717,7 +1717,7 @@ URIHANDLER_FUNC(mod_webdav_subrequest_handler) { if (-1 == c->file.fd && /* open the file if not already open */ -1 == (c->file.fd = open(c->file.name->ptr, O_RDONLY))) { log_error_write(srv, __FILE__, __LINE__, "ss", "open failed: ", strerror(errno)); - + close(fd); return HANDLER_ERROR; } @@ -1726,7 +1726,7 @@ URIHANDLER_FUNC(mod_webdav_subrequest_handler) { strerror(errno), c->file.name, c->file.fd); close(c->file.fd); c->file.fd = -1; - + close(fd); return HANDLER_ERROR; } @@ -2235,7 +2235,7 @@ propmatch_cleanup: if (1 == webdav_parse_chunkqueue(srv, con, p, con->request_content_queue, &xml)) { xmlNode *rootnode = xmlDocGetRootElement(xml); - assert(rootnode); + force_assert(rootnode); if (0 == xmlStrcmp(rootnode->name, BAD_CAST "lockinfo")) { xmlNode *lockinfo;