afh: Use write_all rather than plain write().
authorAndre Noll <maan@systemlinux.org>
Sun, 11 Dec 2011 19:21:53 +0000 (20:21 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 20 Jan 2012 21:57:07 +0000 (22:57 +0100)
We are currently using plain write() to write out the audio
file header. If this results in a short write, or if the write
is interrupted, we should just try again. So it's safer to call
write_all() here.

afh.c

diff --git a/afh.c b/afh.c
index 8810a28..b76c72f 100644 (file)
--- a/afh.c
+++ b/afh.c
@@ -124,7 +124,7 @@ static int cat_file(struct afh_info *afhi, int audio_format_id,
                        &header, &size);
                if (size > 0) {
                        PARA_INFO_LOG("writing header (%zu bytes)\n", size);
-                       ret = write(STDOUT_FILENO, header, size); /* FIXME */
+                       ret = write_all(STDOUT_FILENO, header, size);
                        afh_free_header(header, audio_format_id);
                        if (ret < 0)
                                return ret;