Clean up ef_close() to zap csize along with cache

This commit is contained in:
Markus Armbruster 2011-04-28 20:41:59 +02:00
parent a485084777
commit 5d54e424df

View file

@ -258,14 +258,16 @@ ef_close(int type)
return 0; return 0;
ep = &empfile[type]; ep = &empfile[type];
if (EF_IS_VIEW(type)) if (EF_IS_VIEW(type)) {
ep->cache = NULL; ep->cache = NULL;
else { ep->csize = 0;
} else {
if (!ef_flush(type)) if (!ef_flush(type))
retval = 0; retval = 0;
if (!(ep->flags & EFF_STATIC)) { if (!(ep->flags & EFF_STATIC)) {
free(ep->cache); free(ep->cache);
ep->cache = NULL; ep->cache = NULL;
ep->csize = 0;
} }
if (close(ep->fd) < 0) { if (close(ep->fd) < 0) {
logerror("Error closing %s (%s)", ep->file, strerror(errno)); logerror("Error closing %s (%s)", ep->file, strerror(errno));