libbio: report Bflush/close error from Bterm

This commit is contained in:
Russ Cox 2019-12-19 14:49:35 -05:00
parent f7f0512875
commit 4af8158b53

View file

@ -141,13 +141,15 @@ Bopen(char *name, int mode)
int
Bterm(Biobuf *bp)
{
int ret;
deinstall(bp);
Bflush(bp);
ret = Bflush(bp);
if(bp->flag == Bmagic) {
bp->flag = 0;
close(bp->fid);
if(close(bp->fid) < 0)
ret = -1;
free(bp);
}
return 0;
return ret;
}