From cdb844c16b26f4b58512bb21d76796d245b66149 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Mon, 29 Oct 2012 21:19:52 +0000 Subject: [PATCH] Fix compiler warning in pritest.c. * Made do_channel() exit on a failed write(). (closes issue PRI-145) Reported by: Tzafrir Cohen Patches: fix_unused_write.patch (license #5035) patch uploaded by Tzafrir Cohen Modified git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2305 2fbb986a-6c06-0410-b554-c9c1f0a7f128 --- pritest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pritest.c b/pritest.c index ae6626c..322453d 100644 --- a/pritest.c +++ b/pritest.c @@ -68,7 +68,10 @@ static void do_channel(int fd) int i=0; while ((res = read(fd, buf, READ_SIZE)) > 0 && (i++ < 1000)) { - write(fd, buf, res); + if (write(fd, buf, res) == -1) { + fprintf(stderr, "--!! Failed write: %d\n", errno); + break; + } } }