From: Markus Armbruster Date: Fri, 29 Apr 2011 05:23:07 +0000 (+0200) Subject: Simplify how ef_write() handles write beyond end of file X-Git-Tag: v4.3.28~73 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=2b0b53992f094c65ca2bbffa38bb21d4ac21e590 Simplify how ef_write() handles write beyond end of file --- diff --git a/src/lib/common/file.c b/src/lib/common/file.c index 31ecc260b..a200fca27 100644 --- a/src/lib/common/file.c +++ b/src/lib/common/file.c @@ -520,11 +520,12 @@ ef_write(int type, int id, void *from) ep = &empfile[type]; if (CANT_HAPPEN((ep->flags & (EFF_MEM | EFF_PRIVATE)) == EFF_PRIVATE)) return 0; - if (CANT_HAPPEN((ep->flags & EFF_MEM) ? id >= ep->fids : id > ep->fids)) - return 0; /* not implemented */ new_seqno(ep, from); if (id >= ep->fids) { - /* write beyond end of file extends it, take note */ + /* beyond end of file */ + if (CANT_HAPPEN((ep->flags & EFF_MEM) || id > ep->fids)) + return 0; /* not implemented */ + /* write at end of file extends it */ ep->fids = id + 1; if (ep->onresize) ep->onresize(type);