Patchwork nanddump: Pass Real Names as Arguments to perror

login
register
mail settings
Submitter Grant Erickson
Date Sept. 8, 2008, 6:45 a.m.
Message ID <1220856336-22772-1-git-send-email-gerickson@nuovations.com>
Download mbox | patch
Permalink /patch/202/
State Accepted
Commit 6200113fb94fb2782c220defc301712439543904
Headers show

Comments

Grant Erickson - Sept. 8, 2008, 6:45 a.m.
Pass the MTD device node and dump file name as arguments to perror
rather than more ambigous, static messages on open failures.

Signed-off-by: Grant Erickson <gerickson@nuovations.com>

Patch

diff --git a/nanddump.c b/nanddump.c
index 8c7175c..168fbbb 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -182,7 +182,7 @@  int main(int argc, char * const argv[])
 
 	/* Open MTD device */
 	if ((fd = open(mtddev, O_RDONLY)) == -1) {
-		perror("open flash");
+		perror(mtddev);
 		exit (EXIT_FAILURE);
 	}
 
@@ -249,7 +249,7 @@  int main(int argc, char * const argv[])
 	if (!dumpfile) {
 		ofd = STDOUT_FILENO;
 	} else if ((ofd = open(dumpfile, O_WRONLY | O_TRUNC | O_CREAT, 0644))== -1) {
-		perror ("open outfile");
+		perror (dumpfile);
 		close(fd);
 		exit(EXIT_FAILURE);
 	}