aboutsummaryrefslogtreecommitdiffstats
path: root/libibex
diff options
context:
space:
mode:
author9 <NotZed@Ximian.com>2001-10-29 16:23:32 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-29 16:23:32 +0800
commitfa9505a288ebeab16883eb940bd1418f176fc426 (patch)
tree4efdf67f479c588fe872244128b0c205d462ef88 /libibex
parent5054beec4501b7c1ac4758cfffa6c9278b6cab59 (diff)
downloadgsoc2013-evolution-fa9505a288ebeab16883eb940bd1418f176fc426.tar.gz
gsoc2013-evolution-fa9505a288ebeab16883eb940bd1418f176fc426.tar.zst
gsoc2013-evolution-fa9505a288ebeab16883eb940bd1418f176fc426.zip
Always rename file even if mv failed.
2001-10-29 <NotZed@Ximian.com> * ibex_block.c (ibex_move): Always rename file even if mv failed. svn path=/trunk/; revision=14326
Diffstat (limited to 'libibex')
-rw-r--r--libibex/ChangeLog4
-rw-r--r--libibex/ibex_block.c13
2 files changed, 12 insertions, 5 deletions
diff --git a/libibex/ChangeLog b/libibex/ChangeLog
index 4f85c3845e..5c17fab03e 100644
--- a/libibex/ChangeLog
+++ b/libibex/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-29 <NotZed@Ximian.com>
+
+ * ibex_block.c (ibex_move): Always rename file even if mv failed.
+
2001-10-28 <NotZed@Ximian.com>
* ibex_block.c (ibex_move): New api entry to move an ibex file in
diff --git a/libibex/ibex_block.c b/libibex/ibex_block.c
index 3c96885f4f..5ac538346b 100644
--- a/libibex/ibex_block.c
+++ b/libibex/ibex_block.c
@@ -494,23 +494,26 @@ int ibex_close (ibex *ib)
/* rename/move the ibex file */
int ibex_move(ibex *ib, const char *newname)
{
- int ret = -1;
+ int ret = 0, error;
IBEX_LOCK(ib);
if (ib->blocks)
close_backend(ib);
- if (rename(ib->name, newname) == -1)
- goto error;
+ if (rename(ib->name, newname) == -1) {
+ ret = -1;
+ error = errno;
+ }
g_free(ib->name);
ib->name = g_strdup(newname);
- ret = 0;
-error:
IBEX_UNLOCK(ib);
+ if (ret == -1)
+ errno = error;
+
return ret;
}