summaryrefslogtreecommitdiff
path: root/xdelta1/xdmain.c
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2007-02-02 19:55:28 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2007-02-02 19:55:28 +0000
commit89cf3d8d1839cfc261c48718bf699e9cfca83d81 (patch)
tree5ecca3f2eeb0355935ee3af29a849b6d60b8e188 /xdelta1/xdmain.c
parentfd99e24f74212a442516acd28b8067d81e894a84 (diff)
patch_command: warn about parse error for invalid delta
delta_command: check gzclose() errors to avoid producing an invalid delta
Diffstat (limited to 'xdelta1/xdmain.c')
-rwxr-xr-xxdelta1/xdmain.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/xdelta1/xdmain.c b/xdelta1/xdmain.c
index b1abc74..9d767bb 100755
--- a/xdelta1/xdmain.c
+++ b/xdelta1/xdmain.c
@@ -639,7 +639,7 @@ file_gunzip (const char* name)
639 FILE* out = fopen (new_name, FOPEN_WRITE_ARG); 639 FILE* out = fopen (new_name, FOPEN_WRITE_ARG);
640 gzFile in = gzopen (name, "rb"); 640 gzFile in = gzopen (name, "rb");
641 guint8 buf[1024]; 641 guint8 buf[1024];
642 int nread; 642 int nread, ret;
643 643
644 while ((nread = gzread (in, buf, 1024)) > 0) 644 while ((nread = gzread (in, buf, 1024)) > 0)
645 { 645 {
@@ -656,7 +656,12 @@ file_gunzip (const char* name)
656 return NULL; 656 return NULL;
657 } 657 }
658 658
659 gzclose (in); 659 ret = gzclose (in);
660 if (ret != Z_OK)
661 {
662 xd_error ("gzip input decompression failed: %s\n", name);
663 return NULL;
664 }
660 665
661 if (fclose (out)) 666 if (fclose (out))
662 { 667 {