[coreboot] [commit] r6270 - trunk/util/options

repository service svn at coreboot.org
Tue Jan 18 15:39:01 CET 2011


Author: oxygene
Date: Tue Jan 18 15:38:59 2011
New Revision: 6270
URL: https://tracker.coreboot.org/trac/coreboot/changeset/6270

Log:
Fix fwrite tests.

Signed-off-by: Patrick Georgi <patrick.georgi at secunet.com>
Acked-by: Patrick Georgi <patrick.georgi at secunet.com>

Modified:
   trunk/util/options/build_opt_tbl.c

Modified: trunk/util/options/build_opt_tbl.c
==============================================================================
--- trunk/util/options/build_opt_tbl.c	Tue Jan 18 15:28:45 2011	(r6269)
+++ trunk/util/options/build_opt_tbl.c	Tue Jan 18 15:38:59 2011	(r6270)
@@ -541,7 +541,7 @@
 		}
 
 		/* write the header */
-        	if(!fwrite("unsigned char option_table[] = {",1,32,fp)) {
+        	if(fwrite("unsigned char option_table[] = {",1,32,fp) != 32) {
         	        perror("Error - Could not write image file");
         	        fclose(fp);
 			unlink(tempfilename);
@@ -549,14 +549,14 @@
         	}
 		/* write the array values */
 		for(i=0; i<(int)(ct->size-1); i++) {
-			if(!(i%10) && !err) err=!fwrite("\n\t",1,2,fp);
+			if(!(i%10) && !err) err=(fwrite("\n\t",1,2,fp) != 2);
 			sprintf(buf,"0x%02x,",cmos_table[i]);
-			if(!err) err=!fwrite(buf,1,5,fp);
+			if(!err) err=(fwrite(buf,1,5,fp) != 5);
 		}
 		/* write the end */
 		sprintf(buf,"0x%02x\n",cmos_table[i]);
-		if(!err) err=!fwrite(buf,1,4,fp);
-        	if(!fwrite("};\n",1,3,fp)) {
+		if(!err) err=(fwrite(buf,1,4,fp) != 4);
+        	if(fwrite("};\n",1,3,fp) != 3) {
         	        perror("Error - Could not write image file");
         	        fclose(fp);
 			unlink(tempfilename);
@@ -590,7 +590,7 @@
 		}
 
 		/* write the array values */
-		if(!fwrite(cmos_table, (int)(ct->size-1), 1, fp)) {
+		if(fwrite(cmos_table, (int)(ct->size-1), 1, fp) != 1) {
         	        perror("Error - Could not write image file");
         	        fclose(fp);
 			unlink(tempfilename);




More information about the coreboot mailing list