aboutsummaryrefslogtreecommitdiff
path: root/nanddump.c
diff options
context:
space:
mode:
authorGrant Erickson <gerickson@nuovations.com>2008-09-07 20:45:29 +0000
committerJosh Boyer <jwboyer@gmail.com>2008-09-08 10:28:18 -0400
commitf4f8263572574f682098011d8dced98787aa7c27 (patch)
tree63f419f72b9d055967d1524979bd423baff1db25 /nanddump.c
parentb16c1b630491a461b3ebb55d714d7bb0cd122737 (diff)
nanddump: Utilize Standard Exit Mnemonics
Replace main exit and return status codes with equivalent mnemonics. Signed-off-by: Grant Erickson <gerickson@nuovations.com> Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Josh Boyer <jwboyer@gmail.com>
Diffstat (limited to 'nanddump.c')
-rw-r--r--nanddump.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/nanddump.c b/nanddump.c
index e35caf8..8c7175c 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -51,7 +51,7 @@ static void display_help (void)
"-b --omitbad omit bad blocks from the dump\n"
"-p --prettyprint print nice (hexdump)\n"
"-s addr --startaddress=addr start address\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
static void display_version (void)
@@ -64,7 +64,7 @@ static void display_version (void)
"You may redistribute copies of " PROGRAM "\n"
"under the terms of the GNU General Public Licence.\n"
"See the file `COPYING' for more information.\n");
- exit(0);
+ exit(EXIT_SUCCESS);
}
// Option variables
@@ -126,7 +126,7 @@ static void process_options (int argc, char * const argv[])
case 'f':
if (!(dumpfile = strdup(optarg))) {
perror("stddup");
- exit(1);
+ exit(EXIT_FAILURE);
}
break;
case 'i':
@@ -183,14 +183,14 @@ int main(int argc, char * const argv[])
/* Open MTD device */
if ((fd = open(mtddev, O_RDONLY)) == -1) {
perror("open flash");
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Fill in MTD device capability structure */
if (ioctl(fd, MEMGETINFO, &meminfo) != 0) {
perror("MEMGETINFO");
close(fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Make sure device page sizes are valid */
@@ -201,7 +201,7 @@ int main(int argc, char * const argv[])
!(meminfo.oobsize == 8 && meminfo.writesize == 256)) {
fprintf(stderr, "Unknown flash (not normal NAND)\n");
close(fd);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Read the real oob length */
oob.length = meminfo.oobsize;
@@ -216,19 +216,19 @@ int main(int argc, char * const argv[])
if (ioctl (fd, MEMGETOOBSEL, &old_oobinfo) != 0) {
perror ("MEMGETOOBSEL");
close (fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (ioctl (fd, MEMSETOOBSEL, &none_oobinfo) != 0) {
perror ("MEMSETOOBSEL");
close (fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
oobinfochanged = 1;
break;
default:
perror ("MTDFILEMODE");
close (fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
}
} else {
@@ -251,7 +251,7 @@ int main(int argc, char * const argv[])
} else if ((ofd = open(dumpfile, O_WRONLY | O_TRUNC | O_CREAT, 0644))== -1) {
perror ("open outfile");
close(fd);
- exit(1);
+ exit(EXIT_FAILURE);
}
/* Initialize start/end addresses and block size */
@@ -379,7 +379,7 @@ int main(int argc, char * const argv[])
perror ("MEMSETOOBSEL");
close(fd);
close(ofd);
- return 1;
+ return EXIT_FAILURE;
}
}
/* Close the output file and MTD device */
@@ -387,7 +387,7 @@ int main(int argc, char * const argv[])
close(ofd);
/* Exit happy */
- return 0;
+ return EXIT_SUCCESS;
closeall:
/* The new mode change is per file descriptor ! */
@@ -398,5 +398,5 @@ closeall:
}
close(fd);
close(ofd);
- exit(1);
+ exit(EXIT_FAILURE);
}