[asterisk-commits] kharwell: branch 12 r398002 - in /branches/12: ./ main/asterisk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 30 10:32:15 CDT 2013


Author: kharwell
Date: Fri Aug 30 10:32:13 2013
New Revision: 398002

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398002
Log:
Check return value on fwrite
........

Merged revisions 398000 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    branches/12/   (props changed)
    branches/12/main/asterisk.c

Propchange: branches/12/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: branches/12/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/asterisk.c?view=diff&rev=398002&r1=398001&r2=398002
==============================================================================
--- branches/12/main/asterisk.c (original)
+++ branches/12/main/asterisk.c Fri Aug 30 10:32:13 2013
@@ -2089,7 +2089,7 @@
 
 	char prefix[80];
 	const char *c = s;
-	int res = 0;
+	int num, res = 0;
 
 	do {
 		if (VERBOSE_HASMAGIC(s)) {
@@ -2127,7 +2127,10 @@
 			fputs(prefix, stdout);
 		}
 
-		fwrite(c, sizeof(char), s - c, stdout);
+		num = s - c;
+		if (fwrite(c, sizeof(char), num, stdout) < num) {
+			break;
+		}
 
 		if (!res) {
 			/* if at least some info has been written




More information about the asterisk-commits mailing list