Commit 4335c958 authored by Bruce Momjian's avatar Bruce Momjian

Fix improperly passed file descriptors

Fix for commit 14ea8936

Report by Andres Freund
parent 0a783200
...@@ -558,15 +558,15 @@ _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh) ...@@ -558,15 +558,15 @@ _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh)
if (th->zFH) if (th->zFH)
{ {
res = GZREAD(&((char *) buf)[used], 1, len, th->zFH); res = GZREAD(&((char *) buf)[used], 1, len, th->zFH);
if (res != len && !GZEOF(fh)) if (res != len && !GZEOF(th->zFH))
exit_horribly(modulename, exit_horribly(modulename,
"could not read from input file: %s\n", strerror(errno)); "could not read from input file: %s\n", strerror(errno));
} }
else else
{ {
res = fread(&((char *) buf)[used], 1, len, th->nFH); res = fread(&((char *) buf)[used], 1, len, th->nFH);
if (res != len && !feof(fh)) if (res != len && !feof(th->nFH))
READ_ERROR_EXIT(fh); READ_ERROR_EXIT(th->nFH);
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment