shada: First write temporary file and only then check any permissions

It is not logical that on UNIX permissions can prevent even writing temporary
file, while on other OS it will first write temporary file and then fail during
rename.
This commit is contained in:
ZyX
2015-08-23 18:10:40 +03:00
parent 6de5900c50
commit e1dc9ed464
2 changed files with 33 additions and 46 deletions

View File

@@ -1121,10 +1121,7 @@ include:
Such errors are listed at |shada-critical-contents-errors|.
- If writing to the temporary file failed: e.g. because of the insufficient
space left.
- If renaming file failed: e.g. because of insufficient permissions. On Unix
permissions are checked before trying to create even the temporary file, so
permission error can only happen if permissions were changed after starting
to edit the temporary file and before renaming it.
- If renaming file failed: e.g. because of insufficient permissions.
- If target ShaDa file has different from the Neovim instance's owners (user
and group) and changing them failed. Unix-specific, applies only when
Neovim was launched from root.