}
/* check if image fits to mtd device */
- fd = mtd_open(mtd, O_RDWR);
+ fd = mtd_open(mtd, O_RDWR | O_SYNC);
if(fd < 0) {
fprintf(stderr, "Could not open mtd device: %s\n", mtd);
exit(1);
return 0;
}
+ close(fd);
return 1;
}
struct mtd_info_user mtdInfo;
int fd;
- fd = mtd_open(mtd, O_RDWR);
+ fd = mtd_open(mtd, O_RDWR | O_SYNC);
if(fd < 0) {
fprintf(stderr, "Could not open mtd device: %s\n", mtd);
return 0;
struct mtd_info_user mtdInfo;
struct erase_info_user mtdLockInfo;
- fd = mtd_open(mtd, O_RDWR);
+ fd = mtd_open(mtd, O_RDWR | O_SYNC);
if(fd < 0) {
fprintf(stderr, "Could not open mtd device: %s\n", mtd);
exit(1);
struct mtd_info_user mtdInfo;
struct erase_info_user mtdEraseInfo;
- fd = mtd_open(mtd, O_RDWR);
+ fd = mtd_open(mtd, O_RDWR | O_SYNC);
if(fd < 0) {
fprintf(stderr, "Could not open mtd device: %s\n", mtd);
exit(1);
size_t r, w, e;
struct mtd_info_user mtdInfo;
struct erase_info_user mtdEraseInfo;
+ int ret = 0;
- fd = mtd_open(mtd, O_RDWR);
+ fd = mtd_open(mtd, O_RDWR | O_SYNC);
if(fd < 0) {
fprintf(stderr, "Could not open mtd device: %s\n", mtd);
exit(1);
}
if (!quiet)
fprintf(stderr, "\b\b\b\b");
-
+
+ close(fd);
return 0;
}
break;
}
+ sync();
+
if (boot)
kill(1, 15); // send SIGTERM to init for reboot