I forgot to error check stat() and also I wasn't using the subdir in
is_two_character_sub_directory().
Fixes: d7b3707c612 "util/disk_cache: use stat() to check if entry is a directory"
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
return false;
struct stat sb;
- stat(filename, &sb);
+ int res = stat(filename, &sb);
free(filename);
- if (!S_ISREG(sb.st_mode))
+ if (res == -1 || !S_ISREG(sb.st_mode))
return false;
size_t len = strlen (entry->d_name);
return false;
struct stat sb;
- stat(path, &sb);
+ int res = stat(subdir, &sb);
free(subdir);
- if (!S_ISDIR(sb.st_mode))
+ if (res == -1 || !S_ISDIR(sb.st_mode))
return false;
if (strlen(entry->d_name) != 2)