From 89cf3d8d1839cfc261c48718bf699e9cfca83d81 Mon Sep 17 00:00:00 2001 From: "josh.macdonald" Date: Fri, 2 Feb 2007 19:55:28 +0000 Subject: patch_command: warn about parse error for invalid delta delta_command: check gzclose() errors to avoid producing an invalid delta --- xdelta1/xdmain.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'xdelta1/xdmain.c') 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) FILE* out = fopen (new_name, FOPEN_WRITE_ARG); gzFile in = gzopen (name, "rb"); guint8 buf[1024]; - int nread; + int nread, ret; while ((nread = gzread (in, buf, 1024)) > 0) { @@ -656,7 +656,12 @@ file_gunzip (const char* name) return NULL; } - gzclose (in); + ret = gzclose (in); + if (ret != Z_OK) + { + xd_error ("gzip input decompression failed: %s\n", name); + return NULL; + } if (fclose (out)) { -- cgit v1.2.3