[asterisk-commits] kharwell: branch 11 r398000 - /branches/11/main/asterisk.c

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


Author: kharwell
Date: Fri Aug 30 10:22:35 2013
New Revision: 398000

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

Modified:
    branches/11/main/asterisk.c

Modified: branches/11/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/asterisk.c?view=diff&rev=398000&r1=397999&r2=398000
==============================================================================
--- branches/11/main/asterisk.c (original)
+++ branches/11/main/asterisk.c Fri Aug 30 10:22:35 2013
@@ -1950,7 +1950,7 @@
 
 	char prefix[80];
 	const char *c = s;
-	int res = 0;
+	int num, res = 0;
 
 	do {
 		if (VERBOSE_HASMAGIC(s)) {
@@ -1988,7 +1988,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