vulkan: check results of stat

This commit is contained in:
Wim Taymans 2020-05-20 13:48:27 +02:00
parent f1dc3d9728
commit 4f60dcadc6

View file

@ -327,7 +327,11 @@ static VkShaderModule createShaderModule(struct vulkan_state *s, const char* sha
spa_log_error(s->log, "can't open %s: %m", shaderFile);
return VK_NULL_HANDLE;
}
fstat(fd, &stat);
if (fstat(fd, &stat) < 0) {
spa_log_error(s->log, "can't stat %s: %m", shaderFile);
close(fd);
return VK_NULL_HANDLE;
}
data = mmap(NULL, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0);