]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/unix/handle.cpp
Avoid closing handles twice
[libs/core.git] / source / io / unix / handle.cpp
index 9546df9f579c657f61f658ee235db3e172eec7dd..ea8fa4eeb9797e12f5a598f4c63d0fe6e352d492 100644 (file)
@@ -50,7 +50,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