mirror of
https://github.com/apache/httpd.git
synced 2025-08-01 16:41:19 +00:00
When moving a file over device boundaries and unlinking the source file fails
because it does not exist anymore, don't unlink the destination file. While it is unclear to me how/when this can happen, at least one user encountered the problem: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=273476 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@834697 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@ -428,11 +428,24 @@ static dav_error * dav_fs_copymove_file(
|
||||
apr_file_close(inf);
|
||||
apr_file_close(outf);
|
||||
|
||||
if (is_move && apr_file_remove(src, p) != APR_SUCCESS) {
|
||||
if (is_move && (status = apr_file_remove(src, p)) != APR_SUCCESS) {
|
||||
dav_error *err;
|
||||
int save_errno = errno; /* save the errno that got us here */
|
||||
|
||||
if (apr_file_remove(dst, p) != APR_SUCCESS) {
|
||||
if (APR_STATUS_IS_ENOENT(status)) {
|
||||
/*
|
||||
* Something is wrong here but the result is what we wanted.
|
||||
* We definitely should not remove the destination file.
|
||||
*/
|
||||
err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
|
||||
apr_psprintf(p, "Could not remove source "
|
||||
"file %s after move to %s. The "
|
||||
"server may be in an "
|
||||
"inconsistent state.", src, dst));
|
||||
err->save_errno = save_errno;
|
||||
return err;
|
||||
}
|
||||
else if (apr_file_remove(dst, p) != APR_SUCCESS) {
|
||||
/* ### ACK. this creates an inconsistency. do more!? */
|
||||
|
||||
/* ### use something besides 500? */
|
||||
|
Reference in New Issue
Block a user