output/recorder: fix write() error check

We can only check for negative values if the variable is signed.
This commit is contained in:
Max Kellermann 2012-10-02 00:00:56 +02:00
parent fbcbcdc001
commit d34e55c370
2 changed files with 4 additions and 3 deletions

1
NEWS
View File

@ -1,5 +1,6 @@
ver 0.17.3 (2012/??/??) ver 0.17.3 (2012/??/??)
* output: * output:
- recorder: fix I/O error check
- shout: fix memory leak in error handler - shout: fix memory leak in error handler
ver 0.17.2 (2012/09/30) ver 0.17.2 (2012/09/30)

View File

@ -140,9 +140,9 @@ recorder_output_encoder_to_file(struct recorder_output *recorder,
size_t position = 0; size_t position = 0;
while (true) { while (true) {
size_t nbytes = write(recorder->fd, ssize_t nbytes = write(recorder->fd,
recorder->buffer + position, recorder->buffer + position,
size - position); size - position);
if (nbytes > 0) { if (nbytes > 0) {
position += (size_t)nbytes; position += (size_t)nbytes;
if (position >= size) if (position >= size)