"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);
}
static const char *mtd_device, *img;
if (pad && writeoob) {
fprintf(stderr, "Can't pad when oob data is present.\n");
- exit(1);
+ exit (EXIT_FAILURE);
}
/* Open the device */
if ((fd = open(mtd_device, O_RDWR)) == -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);
}
/* Set erasesize to specified number of blocks - to match jffs2
!(meminfo.oobsize == 128 && meminfo.writesize == 4096)) {
fprintf(stderr, "Unknown flash (not normal NAND)\n");
close(fd);
- exit(1);
+ exit (EXIT_FAILURE);
}
if (autoplace) {
if (ioctl (fd, MEMGETOOBSEL, &old_oobinfo) != 0) {
perror ("MEMGETOOBSEL");
close (fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
// autoplace ECC ?
if (ioctl (fd, MEMSETOOBSEL, &autoplace_oobinfo) != 0) {
perror ("MEMSETOOBSEL");
close (fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
oobinfochanged = 1;
}
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);
}
}
}
if (ioctl (fd, MEMSETOOBSEL, &old_oobinfo) != 0) {
perror ("MEMSETOOBSEL");
close (fd);
- exit (1);
+ exit (EXIT_FAILURE);
}
}
if (imglen > 0) {
perror ("Data was only partially written due to error\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Return happy */
- return 0;
+ return EXIT_SUCCESS;
}