diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-12-04 09:43:40 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-12-04 09:43:40 +0000 |
commit | ebee023a747cf579786667779ccb7f9e72e58a5f (patch) | |
tree | 4280069799b40e46fcc1e82271c60ade0a1c78bf | |
parent | a3dd9fd62def698e71493fb07eb886fa21d6b8c7 (diff) | |
download | perl-URPM-ebee023a747cf579786667779ccb7f9e72e58a5f.tar perl-URPM-ebee023a747cf579786667779ccb7f9e72e58a5f.tar.gz perl-URPM-ebee023a747cf579786667779ccb7f9e72e58a5f.tar.bz2 perl-URPM-ebee023a747cf579786667779ccb7f9e72e58a5f.tar.xz perl-URPM-ebee023a747cf579786667779ccb7f9e72e58a5f.zip |
correctly handle gzread error code
-rw-r--r-- | URPM.xs | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -3031,7 +3031,8 @@ Urpm_parse_synthesis__XS(urpm, filename, ...) memset(&pkg, 0, sizeof(struct s_Package)); buff[sizeof(buff)-1] = 0; p = buff; - while ((buff_len = gzread(f, p, sizeof(buff)-1-(p-buff)) + (p-buff)) != 0) { + while ((buff_len = gzread(f, p, sizeof(buff)-1-(p-buff))) >= 0 && + (buff_len += p-buff)) { p = buff; if ((eol = strchr(p, '\n')) != NULL) { do { @@ -3047,7 +3048,9 @@ Urpm_parse_synthesis__XS(urpm, filename, ...) parse_line(depslist, provides, &pkg, p, urpm, callback); break; } else { + /* move the remaining non-complete-line at beginning */ memmove(buff, p, buff_len-(p-buff)); + /* point to the end of the non-complete-line */ p = &buff[buff_len-(p-buff)]; } } |