diff options
author | Arne Juul <arnej@yahoo-inc.com> | 2016-06-19 13:19:04 +0200 |
---|---|---|
committer | Arne Juul <arnej@yahoo-inc.com> | 2016-06-19 13:19:04 +0200 |
commit | 18d43a0e3d24ccc12917a218e054317c3a853b4f (patch) | |
tree | e9fc49dbc0a4f0d1c5469178c0690c8d713064d2 /vespalib | |
parent | 8c59385b6136d71059010b6b8f678b440ced8d42 (diff) |
fix filedescriptor leak
* if File::open() was called multiple times, the
filedescriptors would leak. Triggered but not caught
by its own unit test.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/io/fileutil.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/vespalib/src/vespa/vespalib/io/fileutil.cpp b/vespalib/src/vespa/vespalib/io/fileutil.cpp index 07f039f530f..2eeffce2832 100644 --- a/vespalib/src/vespa/vespalib/io/fileutil.cpp +++ b/vespalib/src/vespa/vespalib/io/fileutil.cpp @@ -204,6 +204,7 @@ File::open(int flags, bool autoCreateDirectories) { VESPA_STRLOC); } _flags = flags; + if (_close && _fd != -1) close(); _fd = fd; LOG(debug, "open(%s, %d). File opened with file descriptor %d.", _filename.c_str(), flags, fd); |