MCPcopy Create free account
hub / github.com/apache/httpd / dav_fs_delete_walker

Function dav_fs_delete_walker

modules/dav/fs/repos.c:1435–1467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1433}
1434
1435static dav_error * dav_fs_delete_walker(dav_walk_resource *wres, int calltype)
1436{
1437 dav_resource_private *info = wres->resource->info;
1438
1439 /* do not attempt to remove a null resource,
1440 * or a collection with children
1441 */
1442 if (wres->resource->exists &&
1443 (!wres->resource->collection || calltype == DAV_CALLTYPE_POSTFIX)) {
1444 /* try to remove the resource */
1445 apr_status_t result;
1446
1447 result = wres->resource->collection
1448 ? apr_dir_remove(info->pathname, wres->pool)
1449 : apr_file_remove(info->pathname, wres->pool);
1450
1451 /*
1452 ** If an error occurred, then add it to multistatus response.
1453 ** Note that we add it for the root resource, too. It is quite
1454 ** possible to delete the whole darn tree, yet fail on the root.
1455 **
1456 ** (also: remember we are deleting via a postfix traversal)
1457 */
1458 if (result != APR_SUCCESS) {
1459 /* ### assume there is a permissions problem */
1460
1461 /* ### use errno to generate DAV:responsedescription? */
1462 dav_add_response(wres, HTTP_FORBIDDEN, NULL);
1463 }
1464 }
1465
1466 return NULL;
1467}
1468
1469static dav_error * dav_fs_remove_resource(dav_resource *resource,
1470 dav_response **response)

Callers

nothing calls this directly

Calls 1

dav_add_responseFunction · 0.85

Tested by

no test coverage detected