diff options
author | Werner Koch <wk@gnupg.org> | 2016-01-14 16:50:15 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2016-01-14 16:50:24 +0100 |
commit | 8241ed59d05e06252647b26477ed5c2f84895a26 (patch) | |
tree | 915ecd413d70c3896bb2d8dc1979aa6825b664c8 /kbx/keybox-update.c | |
parent | kbx: Add function keybox_tmp_names to avoid code duplication. (diff) | |
download | gnupg2-8241ed59d05e06252647b26477ed5c2f84895a26.tar.xz gnupg2-8241ed59d05e06252647b26477ed5c2f84895a26.zip |
kbx: New function keybox_file_rename to replace rename.
* kbx/keybox-util.c: Include windows.h.
(keybox_file_rename): New.
* kbx/keybox-update.c (rename_tmp_file): Replace remove+rename by
keybox_file_rename.
* g10/keyring.c (rename_tmp_file): Ditto.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'kbx/keybox-update.c')
-rw-r--r-- | kbx/keybox-update.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/kbx/keybox-update.c b/kbx/keybox-update.c index eebcfcad4..ff6590436 100644 --- a/kbx/keybox-update.c +++ b/kbx/keybox-update.c @@ -119,22 +119,15 @@ rename_tmp_file (const char *bakfname, const char *tmpfname, /* First make a backup file except for secret keyboxes. */ if (!secret) { -#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__) - gnupg_remove (bakfname); -#endif - if (rename (fname, bakfname) ) - { - return gpg_error_from_syserror (); - } + rc = keybox_file_rename (fname, bakfname); + if (rc) + return rc; } /* Then rename the file. */ -#if defined(HAVE_DOSISH_SYSTEM) || defined(__riscos__) - gnupg_remove (fname); -#endif - if (rename (tmpfname, fname) ) + rc = keybox_file_rename (tmpfname, fname); + if (rc) { - rc = gpg_error_from_syserror (); if (secret) { /* log_info ("WARNING: 2 files with confidential" */ |