Index: yaffs/utils/mkyaffsimage.c =================================================================== --- yaffs.orig/utils/mkyaffsimage.c +++ yaffs/utils/mkyaffsimage.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "yaffs_guts.h" #include "nand_ecc.h" @@ -56,8 +57,6 @@ static int outFile; -static int error; - static int convert_endian = 0; static int obj_compare(const void *a, const void * b) @@ -236,6 +235,7 @@ static int write_chunk(__u8 *data, __u32 objId, __u32 chunkId, __u32 nBytes) { + int error; yaffs_Tags t; yaffs_Spare s; @@ -386,7 +386,7 @@ static int process_directory(int parent, const char *path) { - + int error = 0; DIR *dir; struct dirent *entry; @@ -396,7 +396,7 @@ if(dir) { - while((entry = readdir(dir)) != NULL) + while(((entry = readdir(dir)) != NULL) && (error >= 0)) { /* Ignore . and .. */ @@ -518,19 +518,23 @@ } else { + printf("%s",full_name); printf(" we don't handle this type\n"); + error = -1; + errno = EINVAL; } } } } - return 0; + return error; } int main(int argc, char *argv[]) { + int error; struct stat stats; printf("mkyaffsimage: image building tool for YAFFS built "__DATE__"\n"); @@ -572,8 +576,8 @@ printf("Processing directory %s into image file %s\n",argv[1],argv[2]); error = write_object_header(1, YAFFS_OBJECT_TYPE_DIRECTORY, &stats, 1,"", -1, NULL); - if(error) - error = process_directory(YAFFS_OBJECTID_ROOT,argv[1]); + if (error >= 0) + error = process_directory(YAFFS_OBJECTID_ROOT,argv[1]); close(outFile);