util_hash.c: fail on negative result code of read.

This commit is contained in:
Enno Boland 2016-06-17 16:55:02 +02:00
parent f0f15304e1
commit cb94ffe1c0

View File

@ -125,6 +125,8 @@ xbps_file_hash_raw(const char *file)
SHA256_Update(&sha256, buf, len); SHA256_Update(&sha256, buf, len);
SHA256_Final(digest, &sha256); SHA256_Final(digest, &sha256);
close(fd); close(fd);
if(len < 0)
return NULL;
return digest; return digest;
} }