From ae2eeb41ad2b3209f90166b49fefedb40edc9432 Mon Sep 17 00:00:00 2001 From: Jehan Bing Date: Wed, 5 Aug 2009 17:41:08 -0700 Subject: nandwrite: fix incorrect use of errno. Signed-off-by: Jehan Bing Signed-off-by: Artem Bityutskiy --- nandwrite.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nandwrite.c b/nandwrite.c index d3486b9..7bb57cd 100644 --- a/nandwrite.c +++ b/nandwrite.c @@ -626,8 +626,8 @@ int main(int argc, char * const argv[]) if (pwrite(fd, writebuf, meminfo.writesize, mtdoffset) != meminfo.writesize) { erase_info_t erase; - perror ("pwrite"); if (errno != EIO) { + perror("pwrite"); goto closeall; } @@ -639,8 +639,9 @@ int main(int argc, char * const argv[]) fprintf(stderr, "Erasing failed write from %08lx-%08lx\n", (long)erase.start, (long)erase.start+erase.length-1); if (ioctl(fd, MEMERASE, &erase) != 0) { + int errno_tmp = errno; perror("MEMERASE"); - if (errno != EIO) { + if (errno_tmp != EIO) { goto closeall; } } -- cgit v1.2.3