summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2012-08-27 13:07:07 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2012-08-27 13:07:07 +0200
commitc68c15757384e6cebd7667139661ab643eebbfbe (patch)
tree1bf8741a1a990eff6fbcb54cfde4c21645626ef1 /tools
parent5a3c597fd599c21a0bb0c551c92393518d3e70b8 (diff)
downloadlvm2-c68c15757384e6cebd7667139661ab643eebbfbe.tar.gz
lvm2-c68c15757384e6cebd7667139661ab643eebbfbe.tar.xz
lvm2-c68c15757384e6cebd7667139661ab643eebbfbe.zip
setvbuf: reopen only valid fd
We should check whether the fd is opened before trying to reopen it. For example, the stdin is closed in test/lib/harness.c causing the test suite to fail.
Diffstat (limited to 'tools')
-rw-r--r--tools/lvmcmdline.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index f3704d66..c5341df6 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1230,7 +1230,7 @@ static void _close_descriptor(int fd, unsigned suppress_warnings,
const char *filename;
/* Ignore bad file descriptors */
- if (fcntl(fd, F_GETFD) == -1 && errno == EBADF)
+ if (!is_valid_fd(fd))
return;
if (!suppress_warnings)