diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2011-05-28 16:43:26 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2011-05-28 18:54:42 +0300 |
commit | 631f4d3ae6adfda84d1a110781d9402c12e16cfc (patch) | |
tree | f26a4e9aca869e9d25348b8fb8d40dab6ae65fee /src | |
parent | Translations: Update Italian translation. (diff) | |
download | xz-631f4d3ae6adfda84d1a110781d9402c12e16cfc.tar.xz |
Don't call close(-1) in tuklib_open_stdxxx() on error.
Thanks to Jim Meyering.
Diffstat (limited to 'src')
-rw-r--r-- | src/common/tuklib_open_stdxxx.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/common/tuklib_open_stdxxx.c b/src/common/tuklib_open_stdxxx.c index 08bc60d8..26702a6a 100644 --- a/src/common/tuklib_open_stdxxx.c +++ b/src/common/tuklib_open_stdxxx.c @@ -39,12 +39,14 @@ tuklib_open_stdxxx(int err_status) | (i == 0 ? O_WRONLY : O_RDONLY)); if (fd != i) { + if (fd != -1) + (void)close(fd); + // Something went wrong. Exit with the // exit status we were given. Don't try // to print an error message, since stderr // may very well be non-existent. This // error should be extremely rare. - (void)close(fd); exit(err_status); } } |