mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-07 13:16:36 +02:00
don't write zero bytes on flush (more efficient and avoids sigpipe)
This commit is contained in:
parent
1cfbcb232f
commit
03518e5bab
1 changed files with 2 additions and 1 deletions
1
sexp.c
1
sexp.c
|
@ -1466,6 +1466,7 @@ int sexp_buffered_flush (sexp ctx, sexp p, int forcep) {
|
||||||
if (off > 0) fwrite(sexp_port_buf(p), 1, off, sexp_port_stream(p));
|
if (off > 0) fwrite(sexp_port_buf(p), 1, off, sexp_port_stream(p));
|
||||||
res = fflush(sexp_port_stream(p));
|
res = fflush(sexp_port_stream(p));
|
||||||
} else if (sexp_filenop(sexp_port_fd(p))) {
|
} else if (sexp_filenop(sexp_port_fd(p))) {
|
||||||
|
if (off > 0)
|
||||||
res = write(sexp_fileno_fd(sexp_port_fd(p)), sexp_port_buf(p), off);
|
res = write(sexp_fileno_fd(sexp_port_fd(p)), sexp_port_buf(p), off);
|
||||||
if (res < off) {
|
if (res < off) {
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue