Simplify how ef_write() handles write beyond end of file

This commit is contained in:
Markus Armbruster 2011-04-29 07:23:07 +02:00
parent f50fc19aab
commit 2b0b53992f

View file

@ -520,11 +520,12 @@ ef_write(int type, int id, void *from)
ep = &empfile[type]; ep = &empfile[type];
if (CANT_HAPPEN((ep->flags & (EFF_MEM | EFF_PRIVATE)) == EFF_PRIVATE)) if (CANT_HAPPEN((ep->flags & (EFF_MEM | EFF_PRIVATE)) == EFF_PRIVATE))
return 0; return 0;
if (CANT_HAPPEN((ep->flags & EFF_MEM) ? id >= ep->fids : id > ep->fids))
return 0; /* not implemented */
new_seqno(ep, from); new_seqno(ep, from);
if (id >= ep->fids) { 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; ep->fids = id + 1;
if (ep->onresize) if (ep->onresize)
ep->onresize(type); ep->onresize(type);