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

Function dav_fs_copymoveset

modules/dav/fs/repos.c:555–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553}
554
555static dav_error *dav_fs_copymoveset(int is_move, apr_pool_t *p,
556 const dav_resource *src,
557 const dav_resource *dst,
558 dav_buffer *pbuf)
559{
560 const char *src_dir;
561 const char *src_file;
562 const char *src_state1;
563 const char *src_state2;
564 const char *dst_dir;
565 const char *dst_file;
566 const char *dst_state1;
567 const char *dst_state2;
568 dav_error *err;
569
570 /* Get directory and filename for resources */
571 /* ### should test these result values... */
572 (void) dav_fs_dir_file_name(src, &src_dir, &src_file);
573 (void) dav_fs_dir_file_name(dst, &dst_dir, &dst_file);
574
575 /* Get the corresponding state files for each resource */
576 dav_dbm_get_statefiles(p, src_file, &src_state1, &src_state2);
577 dav_dbm_get_statefiles(p, dst_file, &dst_state1, &dst_state2);
578#if DAV_DEBUG
579 if ((src_state2 != NULL && dst_state2 == NULL) ||
580 (src_state2 == NULL && dst_state2 != NULL)) {
581 return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, 0,
582 "DESIGN ERROR: dav_dbm_get_statefiles() "
583 "returned inconsistent results.");
584 }
585#endif
586
587 err = dav_fs_copymove_state(is_move, p,
588 src_dir, src_state1,
589 dst_dir, dst_state1,
590 pbuf);
591
592 if (err == NULL && src_state2 != NULL) {
593 err = dav_fs_copymove_state(is_move, p,
594 src_dir, src_state2,
595 dst_dir, dst_state2,
596 pbuf);
597
598 if (err != NULL) {
599 /* ### CRAP. inconsistency. */
600 /* ### should perform some cleanup at the target if we still
601 ### have the original files */
602
603 /* Change the error to reflect the bad server state. */
604 err->status = HTTP_INTERNAL_SERVER_ERROR;
605 err->desc =
606 "Could not fully copy/move the properties. "
607 "The server is now in an inconsistent state.";
608 }
609 }
610
611 return err;
612}

Callers 2

dav_fs_copymove_resourceFunction · 0.85
dav_fs_move_resourceFunction · 0.85

Calls 4

dav_fs_dir_file_nameFunction · 0.85
dav_dbm_get_statefilesFunction · 0.85
dav_new_errorFunction · 0.85
dav_fs_copymove_stateFunction · 0.85

Tested by

no test coverage detected