Simplify how ef_write() handles write beyond end of file
This commit is contained in:
parent
f50fc19aab
commit
2b0b53992f
1 changed files with 4 additions and 3 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue