Enlightenment CVS committal
Author : cedric
Project : e17
Module : libs/eet
Dir : e17/libs/eet/src/lib
Modified Files:
eet_lib.c
Log Message:
Delay unlink and reopen as long as possible in read/write mode.
===================================================================
RCS file: /cvs/e/e17/libs/eet/src/lib/eet_lib.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -3 -r1.112 -r1.113
--- eet_lib.c 17 Jul 2008 15:33:40 -0000 1.112
+++ eet_lib.c 13 Aug 2008 16:40:53 -0000 1.113
@@ -377,6 +377,13 @@
return EET_ERROR_NOT_WRITABLE;
if (!ef->writes_pending)
return EET_ERROR_NONE;
+ if (ef->mode == EET_FILE_MODE_READ_WRITE && ef->fp == NULL)
+ {
+ unlink(ef->path);
+ ef->fp = fopen(ef->path, "wb");
+ if (!ef->fp) return EET_ERROR_NOT_WRITABLE;
+ fcntl(fileno(ef->fp), F_SETFD, FD_CLOEXEC);
+ }
/* calculate string base offset and data base offset */
num = (1 << ef->header->directory->size);
@@ -523,7 +530,7 @@
case EPIPE: error = EET_ERROR_WRITE_ERROR_FILE_CLOSED; break;
default: error = EET_ERROR_WRITE_ERROR; break;
}
- fclose(ef->fp);
+ if (ef->fp) fclose(ef->fp);
ef->fp = NULL;
return error;
}
@@ -1266,11 +1273,7 @@
if (ef->mode == EET_FILE_MODE_READ_WRITE)
{
ef->readfp = ef->fp;
- unlink(ef->path);
- ef->fp = fopen(ef->path, "wb");
- if (eet_test_close(!ef->fp, ef))
- return NULL;
- fcntl(fileno(ef->fp), F_SETFD, FD_CLOEXEC);
+ ef->fp = NULL;
}
/* add to cache */
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@???
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs