]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/unix/handle.cpp
Move Handle::operator void * to the common part
[libs/core.git] / source / io / unix / handle.cpp
index 9546df9f579c657f61f658ee235db3e172eec7dd..307da64fac0a374b32341c05c9092548d69f1ce4 100644 (file)
@@ -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