mirror of https://git.tukaani.org/xz.git
Don't call close(-1) in tuklib_open_stdxxx() on error.
Thanks to Jim Meyering.
This commit is contained in:
parent
bd35d903a0
commit
fc4d443696
|
@ -39,12 +39,14 @@ tuklib_open_stdxxx(int err_status)
|
||||||
| (i == 0 ? O_WRONLY : O_RDONLY));
|
| (i == 0 ? O_WRONLY : O_RDONLY));
|
||||||
|
|
||||||
if (fd != i) {
|
if (fd != i) {
|
||||||
|
if (fd != -1)
|
||||||
|
(void)close(fd);
|
||||||
|
|
||||||
// Something went wrong. Exit with the
|
// Something went wrong. Exit with the
|
||||||
// exit status we were given. Don't try
|
// exit status we were given. Don't try
|
||||||
// to print an error message, since stderr
|
// to print an error message, since stderr
|
||||||
// may very well be non-existent. This
|
// may very well be non-existent. This
|
||||||
// error should be extremely rare.
|
// error should be extremely rare.
|
||||||
(void)close(fd);
|
|
||||||
exit(err_status);
|
exit(err_status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue