summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cc4group.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/cc4group.c b/src/cc4group.c
index a9ecb85..85bc48b 100644
--- a/src/cc4group.c
+++ b/src/cc4group.c
@@ -1282,20 +1282,29 @@ static bool cc4group_extractEntry(CC4Group* const this, const C4GroupEntryData*
{
return false;
}
- write(file, data, root->core.Size);
+
+ bool success = true;
+ if(write(file, data, root->core.Size) != root->core.Size)
+ {
+ SET_ERRNO_ERROR("write: Writing to the target file");
+ success = false;
+ }
if(close(file) == -1)
{
fprintf(stderr, "WARNING: close: Closing the extracted file \"%s\" failed: %s\n", targetPath, strerror(errno));
}
- struct utimbuf times = {.actime = root->core.Modified, .modtime = root->core.Modified};
- if(utime(targetPath, &times) == -1)
+ if(success)
{
- fprintf(stderr, "WARNING: utime: Setting modification time for \"%s\" failed: %s\n", targetPath, strerror(errno));
+ struct utimbuf times = {.actime = root->core.Modified, .modtime = root->core.Modified};
+ if(utime(targetPath, &times) == -1)
+ {
+ fprintf(stderr, "WARNING: utime: Setting modification time for \"%s\" failed: %s\n", targetPath, strerror(errno));
+ }
}
- return true;
+ return success;
}
static bool cc4group_extractChildren(CC4Group* const this, const C4GroupEntryData* const root, const char* const targetPath)