Don't cache files that are empty or not files. Avoids crashing on the likes of 'HELP .'
This commit is contained in:
parent
641eb2c3c8
commit
d06f3da955
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue