unsigned char *ptr;
uint8_t zeros[0x4000];
int size;
+ int ret;
if (align > 0x4000) {
fprintf(stderr, "Wrong alignment requested %d\n", align);
}
size = sbuf.st_size;
- lseek(ifd, offset, SEEK_SET);
+ ret = lseek(ifd, offset, SEEK_SET);
+ if (ret < 0) {
+ fprintf(stderr, "%s: lseek error %s\n",
+ __func__, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
if (write(ifd, ptr, size) != size) {
fprintf(stderr, "Write error %s\n", strerror(errno));
exit(EXIT_FAILURE);
int tail;
int zero = 0;
uint8_t zeros[4096];
- int size;
+ int size, ret;
memset(zeros, 0, sizeof(zeros));
}
size = sbuf.st_size;
- lseek(ifd, offset, SEEK_SET);
+ ret = lseek(ifd, offset, SEEK_SET);
+ if (ret < 0) {
+ fprintf(stderr, "%s: lseek error %s\n",
+ __func__, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+
if (write(ifd, ptr, size) != size) {
fprintf(stderr, "Write error %s\n",
strerror(errno));
char *tmp_filename = NULL;
uint32_t size = 0;
uint32_t file_padding = 0;
+ int ret;
int container = -1;
int cont_img_count = 0; /* indexes to arrange the container */
} while (img_sp->option != NO_IMG);
/* Add padding or skip appended container */
- lseek(ofd, file_padding, SEEK_SET);
+ ret = lseek(ofd, file_padding, SEEK_SET);
+ if (ret < 0) {
+ fprintf(stderr, "%s: lseek error %s\n",
+ __func__, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
/* Note: Image offset are not contained in the image */
tmp = flatten_container_header(&imx_header, container + 1, &size,