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
This commit is contained in:
9
2001-10-29 08:23:32 +00:00
committed by Michael Zucci
parent 5054beec45
commit fa9505a288
2 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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;
}