gnome-keyring r1540 - in trunk: . pkcs11/gck
- From: nnielsen svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-keyring r1540 - in trunk: . pkcs11/gck
- Date: Sun, 8 Feb 2009 23:32:01 +0000 (UTC)
Author: nnielsen
Date: Sun Feb 8 23:32:01 2009
New Revision: 1540
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1540&view=rev
Log:
Fix problem not deleting temporary files after doing a transaction write.
Modified:
trunk/ChangeLog
trunk/pkcs11/gck/gck-transaction.c
Modified: trunk/pkcs11/gck/gck-transaction.c
==============================================================================
--- trunk/pkcs11/gck/gck-transaction.c (original)
+++ trunk/pkcs11/gck/gck-transaction.c Sun Feb 8 23:32:01 2009
@@ -134,8 +134,9 @@
gchar *original;
gchar *ext;
+ /* When failed, rename temporary back */
if (gck_transaction_get_failed (self)) {
-
+
/* Figure out the original file name */
original = g_strdup (path);
ext = strrchr (original, '.');
@@ -143,13 +144,21 @@
*ext = '\0';
/* Now rename us back */
- if (!g_rename (path, original) == -1) {
+ if (g_rename (path, original) == -1) {
g_warning ("couldn't restore original file, data may be lost: %s: %s",
original, g_strerror (errno));
ret = FALSE;
}
g_free (original);
+
+ /* When succeeded, remove temporary */
+ } else {
+ if (g_unlink (path) == -1) {
+ g_warning ("couldn't delete temporary backup file: %s: %s",
+ path, g_strerror (errno));
+ ret = TRUE; /* Not actually that bad of a situation */
+ }
}
g_free (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]