Do not create a kernel cache file if build failed (actually if size ended up as zero).
struct stat cst;
- if (stat (cached_file, &cst) == -1)
+ if ((stat (cached_file, &cst) == -1) || cst.st_size == 0)
{
cached = 0;
}
void writeProgramBin (char *dst, u8 *binary, size_t binary_size)
{
- FILE *fp = fopen (dst, "wb");
+ if (binary_size > 0)
+ {
+ FILE *fp = fopen (dst, "wb");
- fwrite (binary, sizeof (u8), binary_size, fp);
+ fwrite (binary, sizeof (u8), binary_size, fp);
- fflush (fp);
- fclose (fp);
+ fflush (fp);
+ fclose (fp);
+ }
}
/**