summaryrefslogtreecommitdiff
path: root/nandwrite.c
diff options
context:
space:
mode:
authorJehan Bing <jehan@orb.com>2009-08-05 17:41:08 -0700
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-08-11 16:14:20 +0300
commitae2eeb41ad2b3209f90166b49fefedb40edc9432 (patch)
tree758611ddfde2c4452a57661a21161fb764f77e9f /nandwrite.c
parent07005d915d6a79dbdee14b0c4360df5058c3a98b (diff)
nandwrite: fix incorrect use of errno.
Signed-off-by: Jehan Bing <jehan@orb.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'nandwrite.c')
-rw-r--r--nandwrite.c5
1 files 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;
}
}