[coreboot] New patch to review for coreboot: 3d24e00 ifdtool: Use perror for file write errors

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Tue Jul 24 00:12:19 CEST 2012


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1299

-gerrit

commit 3d24e001d146e96eedd24fe54931116a6ec3070f
Author: Stefan Reinauer <reinauer at chromium.org>
Date:   Mon Jun 18 16:02:20 2012 -0700

    ifdtool: Use perror for file write errors
    
    The "Error while writing." error messages did not output a new line
    which made the output look weird. With this patch, it should look like
    this:
    
    $ ifdtool -x 3rdparty/mainboard/google/parrot/descriptor.bin
    File 3rdparty/mainboard/google/parrot/descriptor.bin is 4096 bytes
    Found Flash Descriptor signature at 0x00000010
    Flash Region 0 (Flash Descriptor): 00000000 - 00000fff
    Flash Region 1 (BIOS): 00200000 - 007fffff
    Error while writing: Bad address
    Flash Region 2 (Intel ME): 00001000 - 001fffff
    Error while writing: Bad address
    Flash Region 3 (GbE): 00fff000 - 00000fff (unused)
    Flash Region 4 (Platform Data): 00fff000 - 00000fff (unused)
    
    Change-Id: I784ff72d0673f167dbf0bd10921406abd685ce72
    Signed-off-by: Stefan Reinauer <reinauer at google.com>
---
 util/ifdtool/ifdtool.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index e78ac60..1b418d1 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -296,7 +296,7 @@ static void write_regions(char *image, int size)
 					 O_WRONLY | O_CREAT | O_TRUNC,
 					 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 			if (write(region_fd, image + region.base, region.size) != region.size)
-				printf("Error while writing.");
+				perror("Error while writing");
 			close(region_fd);
 		}
 	}
@@ -317,7 +317,7 @@ static void write_image(char *filename, char *image, int size)
 			 O_WRONLY | O_CREAT | O_TRUNC,
 			 S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 	if (write(new_fd, image, size) != size)
-		printf("Error while writing.");
+		perror("Error while writing");
 	close(new_fd);
 }
 




More information about the coreboot mailing list