0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

Don't cache files that are empty or not files. Avoids crashing on the likes of 'HELP .'

This commit is contained in:
Stephen Bennett 2010-01-21 16:27:34 +00:00
parent 641eb2c3c8
commit d06f3da955

View file

@ -143,6 +143,13 @@ cache_file(const char *filename, const char *shortname, int flags)
rb_dlinkAddTailAlloc(emptyline, &cacheptr->contents);
}
if (0 == rb_dlink_list_length(&cacheptr->contents))
{
/* No contents. Don't cache it after all. */
rb_free(cacheptr);
cacheptr = NULL;
}
fclose(in);
return cacheptr;
}