diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2018-04-25 19:22:18 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2018-05-16 13:24:01 +0200 |
| commit | 5b609d292642a9146a64f60ff75e3bdc44c8d14a (patch) | |
| tree | ee978ab2ac0682ef861a3bbb046a5c5c272dabd8 /text.h | |
| parent | b23116112e21fbdecc51e2029bfe01c0f19b5267 (diff) | |
| download | vis-5b609d292642a9146a64f60ff75e3bdc44c8d14a.tar.gz vis-5b609d292642a9146a64f60ff75e3bdc44c8d14a.tar.xz | |
text: use mkstemp(3) for temporary file creation in atomic saves
Instead of simply appending a tilde to the original file name, we now
create an unique temporary file based on the pattern `.filename.vis.XXXXXX`.
In case the file does not yet exist, we use 0666 & ~umask as permission,
(this should match the previous `open(2)` based behavior).
Diffstat (limited to 'text.h')
| -rw-r--r-- | text.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -280,9 +280,10 @@ enum TextSaveMethod { /** * Save file atomically using `rename(2)`. * - * Creates a new file named `filename~` and tries to restore all important - * meta data. After which it is atomically moved to its final - * (possibly already existing) destination using `rename(2)`. + * Creates a temporary file, restores all important meta data, + * before moving it atomically to its final (possibly already + * existing) destination using `rename(2)`. For new files, + * permissions are set to `0666 & ~umask`. * * @rst * .. warning:: This approach does not work if: |
