1
0
mirror of https://github.com/Zygo/bees.git synced 2025-06-16 09:36:17 +02:00

fd: make the close method on IOHandle private

Fd's cache does not handle changes in the state of its IOHandle parameter.
If we allow:

	Fd f;
	f->close();

then Fd ends up caching a pointer to a closed Fd, and will become very
badly confused if a new Fd appears with the same int identifier.

Fix by removing the close method.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell
2021-04-04 14:17:32 -04:00
parent 06062cfd96
commit 7cffad5fc3
2 changed files with 13 additions and 8 deletions

View File

@ -35,11 +35,11 @@ namespace crucible {
IOHandle& operator=(IOHandle &&) = delete;
IOHandle& operator=(const IOHandle &) = delete;
int m_fd;
void close();
public:
virtual ~IOHandle();
IOHandle(int fd = -1);
int get_fd() const;
void close();
};
class Fd {