X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fio%2Funix%2Fhandle.cpp;h=307da64fac0a374b32341c05c9092548d69f1ce4;hb=b6ca62a3789b11931b8169e071a7777d8f149ee8;hp=9546df9f579c657f61f658ee235db3e172eec7dd;hpb=609c9a508cfdc7b42c46c4f21d17639204165a00;p=libs%2Fcore.git diff --git a/source/io/unix/handle.cpp b/source/io/unix/handle.cpp index 9546df9..307da64 100644 --- a/source/io/unix/handle.cpp +++ b/source/io/unix/handle.cpp @@ -8,12 +8,6 @@ namespace Msp { namespace IO { -Handle::operator const void *() const -{ - return priv->handle!=-1 ? this : 0; -} - - void sys_set_blocking(Handle &handle, bool b) { int flags = fcntl(*handle, F_GETFD); @@ -50,7 +44,11 @@ unsigned sys_write(Handle &handle, const char *buf, unsigned size) void sys_close(Handle &handle) { - close(*handle); + if(handle) + { + close(*handle); + *handle = INVALID_HANDLE_VALUE; + } } } // namespace IO