forked from enlightenment/efl
eet: improve error message during eet_close.
This commit is contained in:
parent
699a57c7e4
commit
6a7257f5a7
|
@ -341,16 +341,24 @@ eet_flush2(Eet_File *ef)
|
||||||
unlink(ef->path);
|
unlink(ef->path);
|
||||||
fd = open(ef->path, O_CREAT | O_TRUNC | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR);
|
fd = open(ef->path, O_CREAT | O_TRUNC | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
ERR("Can't write file '%s'.", ef->path);
|
||||||
return EET_ERROR_NOT_WRITABLE;
|
return EET_ERROR_NOT_WRITABLE;
|
||||||
|
}
|
||||||
|
|
||||||
fp = fdopen(fd, "wb");
|
fp = fdopen(fd, "wb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
|
{
|
||||||
|
ERR("Can't write file '%s'.", ef->path);
|
||||||
return EET_ERROR_NOT_WRITABLE;
|
return EET_ERROR_NOT_WRITABLE;
|
||||||
|
}
|
||||||
|
|
||||||
if (fcntl(fd, F_SETFD, FD_CLOEXEC)) ERR("can't set CLOEXEC on write fd");
|
if (fcntl(fd, F_SETFD, FD_CLOEXEC)) ERR("can't set CLOEXEC on write fd");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return EET_ERROR_NOT_WRITABLE;
|
return EET_ERROR_NOT_WRITABLE;
|
||||||
|
}
|
||||||
|
|
||||||
/* calculate string base offset and data base offset */
|
/* calculate string base offset and data base offset */
|
||||||
num = (1 << ef->header->directory->size);
|
num = (1 << ef->header->directory->size);
|
||||||
|
@ -521,6 +529,7 @@ eet_flush2(Eet_File *ef)
|
||||||
write_error:
|
write_error:
|
||||||
if (ferror(fp))
|
if (ferror(fp))
|
||||||
{
|
{
|
||||||
|
ERR("Error during write on '%s'.", ef->path);
|
||||||
switch (errno)
|
switch (errno)
|
||||||
{
|
{
|
||||||
case EFBIG: error = EET_ERROR_WRITE_ERROR_FILE_TOO_BIG; break;
|
case EFBIG: error = EET_ERROR_WRITE_ERROR_FILE_TOO_BIG; break;
|
||||||
|
@ -1256,11 +1265,14 @@ static Eet_Error
|
||||||
eet_internal_close(Eet_File *ef,
|
eet_internal_close(Eet_File *ef,
|
||||||
Eina_Bool locked)
|
Eina_Bool locked)
|
||||||
{
|
{
|
||||||
Eet_Error err;
|
Eet_Error err = EET_ERROR_NONE;
|
||||||
|
|
||||||
/* check to see its' an eet file pointer */
|
/* check to see its' an eet file pointer */
|
||||||
if (eet_check_pointer(ef))
|
if (eet_check_pointer(ef))
|
||||||
|
{
|
||||||
|
ERR("Bad file descriptor '%p'\n", ef);
|
||||||
return EET_ERROR_BAD_OBJECT;
|
return EET_ERROR_BAD_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
if (!locked)
|
if (!locked)
|
||||||
LOCK_CACHE;
|
LOCK_CACHE;
|
||||||
|
|
Loading…
Reference in New Issue