aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-03-09 05:36:39 +0000
committerlloyd <[email protected]>2008-03-09 05:36:39 +0000
commit8b314524366dd87af4fe7ddb3f22f32ddad2d59b (patch)
tree89b2c7e0adab2509e2e97d5e1af22c0ef1a3bc5f
parent478710c5f35dabcb81a4ae2c26052b68606570ed (diff)
Avoid closing an invalid file descriptor, even though it is basically
harmless, to avoid a valgrind warning
-rw-r--r--modules/es_dev/es_dev.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/es_dev/es_dev.cpp b/modules/es_dev/es_dev.cpp
index e63cc9f05..1a30eb75f 100644
--- a/modules/es_dev/es_dev.cpp
+++ b/modules/es_dev/es_dev.cpp
@@ -24,7 +24,7 @@ class Device_Reader
typedef int fd_type;
Device_Reader(fd_type device_fd) : fd(device_fd) {}
- ~Device_Reader() { ::close(fd); }
+ ~Device_Reader() { if(fd > 0) { ::close(fd); } }
u32bit get(byte out[], u32bit length);
static fd_type open(const std::string& pathname);