mirror of
https://review.haiku-os.org/haiku
synced 2025-01-28 01:04:51 +01:00
28 lines
310 B
C
28 lines
310 B
C
|
/*
|
||
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||
|
* Distributed under the terms of the MIT License.
|
||
|
*/
|
||
|
#ifndef FD_CLOSER_H
|
||
|
#define FD_CLOSER_H
|
||
|
|
||
|
|
||
|
struct FDCloser {
|
||
|
FDCloser(int fd)
|
||
|
:
|
||
|
fFD(fd)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
~FDCloser()
|
||
|
{
|
||
|
if (fFD >= 0)
|
||
|
close(fFD);
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
int fFD;
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif // FD_CLOSER_H
|