-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure of rename() may cause delete files. #7306
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a case were
rename()
may fail, but also delete files in the process that it shouldn't.This can happen when
oldpath
refers to a non-existent file, whilenewpath
refers to a file that is actually there.The code will first delete
newpath
, and then try to rename the first file. If this fails,newpath
is lost.The following snippet demonstrates this:
The text was updated successfully, but these errors were encountered: