[PATCH 4/5 v3] [MTD-UTILS] Unified reading from standard input and from file
Jehan Bing
jehan at orb.com
Wed Aug 5 20:41:08 EDT 2009
Fix incorrect use of errno.
Signed-off-by: Jehan Bing <jehan at orb.com>
--- a/nandwrite.c 2009-08-04 17:10:59.000000000 -0700
+++ b/nandwrite.c 2009-08-04 17:11:03.000000000 -0700
@@ -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;
}
}
More information about the linux-mtd
mailing list