nandwrite: Pass Real Names as Arguments to perror
PATCH 3/6 nandwrite: Pass Real Names as Arguments to perror
Pass the MTD device node and input file name as arguments to perror rather than more ambigous, static messages on open failures.
Signed-off-by Grant Erickson <[email protected]>
---
This change results in more meaningful error messages when there is an error with the MTD device node and input file positional parameters:
# nandwrite /dev/foobar /dev/foobar: No such file or directory
versus:
# nandwrite /dev/foobar vmlinux open flash: No such file or directory
or:
# nandwrite /dev/mtd8 foobar open input file: No such file or directory
versus:
# ./nandwrite /dev/mtd8 foobar foobar: No such file or directory
nandwrite.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
nandwrite.c +2 -2
@@ -230,7 +230,7 @@ int main(int argc, char * const argv[])/* Open the device */ if ((fd =open (mtd_device,O_RDWR )) ==-1 ) { -perror ("open flash" ); +perror (mtd_device);exit (EXIT_FAILURE ); }
@@ -337,7 +337,7 @@ int main(int argc, char * const argv[])/* Open the input file */ if ((ifd =open (img,O_RDONLY )) ==-1 ) { -perror ("open input file" ); +perror (img); goto restoreoob; }
Signature · 1 line
1.6.0.1