[Pkg-voip-commits] r10008 - /libpri/trunk/debian/patches/fix_unused

tzafrir at alioth.debian.org tzafrir at alioth.debian.org
Wed Oct 10 18:20:49 UTC 2012


Author: tzafrir
Date: Wed Oct 10 18:20:49 2012
New Revision: 10008

URL: http://svn.debian.org/wsvn/pkg-voip/?sc=1&rev=10008
Log:
Fix a minor build error exposed with the build flags

Added:
    libpri/trunk/debian/patches/fix_unused

Added: libpri/trunk/debian/patches/fix_unused
URL: http://svn.debian.org/wsvn/pkg-voip/libpri/trunk/debian/patches/fix_unused?rev=10008&op=file
==============================================================================
--- libpri/trunk/debian/patches/fix_unused (added)
+++ libpri/trunk/debian/patches/fix_unused Wed Oct 10 18:20:49 2012
@@ -1,0 +1,28 @@
+From: Tzafrir Cohen <tzafrir at debian.org>
+Subject: Handle a return value that must be handled
+Bug: https://issues.asterisk.org/jira/browse/PRI-145
+
+The return value of write must be checked. In this case: stop the loop
+if the write failed.
+
+--- a/pritest.c
++++ b/pritest.c
+@@ -64,11 +64,16 @@ static void do_channel(int fd)
+ {
+ 	/* This is the part that runs on a given channel */
+ 	char buf[READ_SIZE];
+-	int res;
++	int res, res_write;
+ 	int i=0;
+ 
+ 	while ((res = read(fd, buf, READ_SIZE)) > 0 && (i++ < 1000)) {
+-		write(fd, buf, res);
++		res_write = write(fd, buf, res);
++		if (res_write == -1) {
++			fprintf(stderr, "--!! %s: Failed write: %d\n",
++					__func__, errno);
++			break;
++		}
+ 	}
+ }
+ 




More information about the Pkg-voip-commits mailing list