]> git.pond.sub.org Git - empserver/commitdiff
Clean up ef_close() to zap csize along with cache
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 28 Apr 2011 18:41:59 +0000 (20:41 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 25 Jun 2011 14:50:06 +0000 (16:50 +0200)
src/lib/common/file.c

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