diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/util.cc | 9 | ||||
-rw-r--r-- | src/libutil/util.hh | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index e77009321d8d..0af6ee149bae 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -415,6 +415,15 @@ bool AutoCloseFD::isOpen() } +/* Pass responsibility for closing this fd to the caller. */ +int AutoCloseFD::borrow() +{ + int oldFD = fd; + fd = -1; + return oldFD; +} + + void Pipe::create() { int fds[2]; diff --git a/src/libutil/util.hh b/src/libutil/util.hh index a79c07305df8..d947c34252a7 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -184,6 +184,7 @@ public: operator int(); void close(); bool isOpen(); + int borrow(); }; |