mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
Fixed delta updates bug wherein updates fail on empty file.
mmap()ing empty files caused EINVAL to be returned and _hashOfFile would return an incorrect result. This has been rectified.
This commit is contained in:
1 parent
a8f26b16c2
commit
e2a59fccb2
1 file changed
+5
@@ -78,6 +78,11 @@ static void _hashOfFile(unsigned char* hash, FTSENT *ent)
|
||||
}
|
||||
|
||||
size_t fileSize = (size_t)ent->fts_statp->st_size;
|
||||
if (fileSize == 0) {
|
||||
_hashOfBuffer(hash, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
void *buffer = mmap(0, fileSize, PROT_READ, MAP_FILE | MAP_PRIVATE, fileDescriptor, 0);
|
||||
if (buffer == (void*)-1) {
|
||||
close(fileDescriptor);
|
||||
|
||||
Reference in new issue
Block a user