X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/663888501e27e6bfcd01bd0f43620b9d08cd2b7b..4ec64f804a95243857577ac900230f0e653dd4c0:/package/openwrt/jffs2root.c diff --git a/package/openwrt/jffs2root.c b/package/openwrt/jffs2root.c index e74c89a9b..77519a4a6 100644 --- a/package/openwrt/jffs2root.c +++ b/package/openwrt/jffs2root.c @@ -48,7 +48,10 @@ void init_crc32() unsigned long crc; unsigned long poly = 0xEDB88320L; int n, bit; - crc32 = (unsigned long *) malloc(256 * sizeof(unsigned long)); + if ((crc32 = (unsigned long *) malloc(256 * sizeof(unsigned long))) == (void *)-1) { + perror("malloc"); + exit(1); + } for (n = 0; n < 256; n++) { crc = (unsigned long) n; for (bit = 0; bit < 8; bit++) @@ -81,11 +84,13 @@ int main(int argc, char **argv) if (argc > 1 && !strcmp(argv[1],"--move")) { if (ptr->offsets[1] >= ptr->len) { printf("Partition already moved outside trx\n"); +#if 0 } else if (ptr->offsets[1] & 0x0001ffff) { printf("Partition does not start on a block boundary\n"); +#endif } else { init_crc32(); - bzero((void *)((int)ptr + ptr->len), (size_t)(len - ptr->len)); + //bzero((void *)((int)ptr + ptr->len), (size_t)(len - ptr->len)); ptr->len = ptr->offsets[1]; ptr->crc32 = crc32buf((void *) &(ptr->flag_version), ptr->len - offsetof(struct trx_header, flag_version)); msync(ptr,len,MS_SYNC|MS_INVALIDATE);