aboutsummaryrefslogtreecommitdiffstats
path: root/libibex/ibex_block.c
diff options
context:
space:
mode:
Diffstat (limited to 'libibex/ibex_block.c')
-rw-r--r--libibex/ibex_block.c13
1 files changed, 8 insertions, 5 deletions
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;
}