linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/5 v3] [MTD-UTILS] Unified reading from standard input and from file
@ 2009-08-06  0:41 Jehan Bing
  0 siblings, 0 replies; only message in thread
From: Jehan Bing @ 2009-08-06  0:41 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org

Fix incorrect use of errno.

Signed-off-by: Jehan Bing <jehan@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;
 				}
 			}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-06  0:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-06  0:41 [PATCH 4/5 v3] [MTD-UTILS] Unified reading from standard input and from file Jehan Bing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).