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

Function dav_fs_deleteset

modules/dav/fs/repos.c:614–661  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

612}
613
614static dav_error *dav_fs_deleteset(apr_pool_t *p, const dav_resource *resource)
615{
616 const char *dirpath;
617 const char *fname;
618 const char *state1;
619 const char *state2;
620 const char *pathname;
621 apr_status_t status;
622
623 /* Get directory, filename, and state-file names for the resource */
624 /* ### should test this result value... */
625 (void) dav_fs_dir_file_name(resource, &dirpath, &fname);
626 dav_dbm_get_statefiles(p, fname, &state1, &state2);
627
628 /* build the propset pathname for the file */
629 pathname = apr_pstrcat(p,
630 dirpath,
631 "/" DAV_FS_STATE_DIR "/",
632 state1,
633 NULL);
634
635 /* note: we may get ENOENT if the state dir is not present */
636 if ((status = apr_file_remove(pathname, p)) != APR_SUCCESS
637 && !APR_STATUS_IS_ENOENT(status)) {
638 return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
639 "Could not remove properties.");
640 }
641
642 if (state2 != NULL) {
643 /* build the propset pathname for the file */
644 pathname = apr_pstrcat(p,
645 dirpath,
646 "/" DAV_FS_STATE_DIR "/",
647 state2,
648 NULL);
649
650 if ((status = apr_file_remove(pathname, p)) != APR_SUCCESS
651 && !APR_STATUS_IS_ENOENT(status)) {
652 /* ### CRAP. only removed half. */
653 return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, status,
654 "Could not fully remove properties. "
655 "The server is now in an inconsistent "
656 "state.");
657 }
658 }
659
660 return NULL;
661}
662
663/* --------------------------------------------------------------------
664**

Callers 1

dav_fs_remove_resourceFunction · 0.85

Calls 3

dav_fs_dir_file_nameFunction · 0.85
dav_dbm_get_statefilesFunction · 0.85
dav_new_errorFunction · 0.85

Tested by

no test coverage detected