Correct a bug in gzip(1): make sure that initialize isb with fstat() on
input file before using it. PR: bin/147275 Submitted by: thomas MFC after: 1 week
This commit is contained in:
parent
3a2c6562f3
commit
09e979e915
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208888
@ -1224,17 +1224,23 @@ file_compress(char *file, char *outfile, size_t outsize)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SMALL
|
||||||
|
if (fstat(in, &isb) != 0) {
|
||||||
|
maybe_warn("couldn't stat: %s", file);
|
||||||
|
close(in);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (cflag == 0) {
|
if (cflag == 0) {
|
||||||
#ifndef SMALL
|
#ifndef SMALL
|
||||||
if (fstat(in, &isb) == 0) {
|
if (isb.st_nlink != 1 && fflag == 0) {
|
||||||
if (isb.st_nlink > 1 && fflag == 0) {
|
|
||||||
maybe_warnx("%s has %d other link%s -- "
|
maybe_warnx("%s has %d other link%s -- "
|
||||||
"skipping", file, isb.st_nlink - 1,
|
"skipping", file, isb.st_nlink - 1,
|
||||||
isb.st_nlink == 1 ? "" : "s");
|
isb.st_nlink == 1 ? "" : "s");
|
||||||
close(in);
|
close(in);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (fflag == 0 && (suff = check_suffix(file, 0))
|
if (fflag == 0 && (suff = check_suffix(file, 0))
|
||||||
&& suff->zipped[0] != 0) {
|
&& suff->zipped[0] != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user