mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fix file descriptor leak in hstox test.
We return E_WRITE because closing only fails when an I/O error occurs, which is likely an error from the write() call above. See close(2) for details. http://man7.org/linux/man-pages/man2/close.2.html
This commit is contained in:
parent
2e33ab26df
commit
a3079e82dd
|
@ -89,6 +89,7 @@ static int write_sample_input(msgpack_object req)
|
||||||
msgpack_pack_object(&pk, req);
|
msgpack_pack_object(&pk, req);
|
||||||
|
|
||||||
check_return(E_WRITE, write(fd, sbuf.data, sbuf.size));
|
check_return(E_WRITE, write(fd, sbuf.data, sbuf.size));
|
||||||
|
check_return(E_WRITE, close(fd));
|
||||||
|
|
||||||
return E_OK;
|
return E_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user