gzdopen() may not close fd

git-svn: trunk@3488
remotes/push_mirror/metadata
Tomasz Kojm 18 years ago
parent 68a364d4e2
commit 638d881d9f
  1. 4
      ChangeLog
  2. 3
      libclamav/cvd.c

@ -1,3 +1,7 @@
Wed Jan 9 12:29:48 CET 2008 (tk)
---------------------------------
* libclamav/cvd.c: gzdopen() may not close fd
Wed Jan 9 11:13:25 CET 2008 (tk)
---------------------------------
* libclamav/cvd.c: fix error path descriptor leak (reported by G. Tiesi)

@ -51,6 +51,7 @@ int cli_untgz(int fd, const char *destdir)
int nbytes, nread, nwritten, in_block = 0, fdd;
unsigned int size, pathlen = strlen(destdir) + 100 + 5;
FILE *outfile = NULL;
struct stat foo;
gzFile *infile;
@ -63,6 +64,8 @@ int cli_untgz(int fd, const char *destdir)
if((infile = gzdopen(fdd, "rb")) == NULL) {
cli_errmsg("cli_untgz: Can't gzdopen() descriptor %d, errno = %d\n", fdd, errno);
if(fstat(fdd, &foo) == 0)
close(fdd);
return -1;
}

Loading…
Cancel
Save