Esempio n. 1
0
void file::close()
{
    if( (HANDLE)this->handle_ != INVALID_HANDLE_VALUE ) {
        if( close_nothrow((HANDLE)this->handle_) == -1 ) { 
            throw_get_last_error("close failed");
        }
    }
    release();
}
Esempio n. 2
0
file::~file()
{
    if( (HANDLE)this->handle_ != INVALID_HANDLE_VALUE ) {
        if( close_nothrow((HANDLE)this->handle_) == -1 ) {
            // TODO: add silent failures reporting
            // int err = get_last_error();
            // tinfra::silent_failure(fmt("file close failed: %i" % blabla )
        }
        release();
    }
}
Esempio n. 3
0
int
rpl_close (int fd)
{
#if WINDOWS_SOCKETS
  int retval = execute_all_close_hooks (close_nothrow, fd);
#else
  int retval = close_nothrow (fd);
#endif

#if REPLACE_FCHDIR
  if (retval >= 0)
    _gl_unregister_fd (fd);
#endif

  return retval;
}
Esempio n. 4
0
/* Override close() to call into other gnulib modules: */
int rpl_close(int fd)
{
#if defined(WINDOWS_SOCKETS) && WINDOWS_SOCKETS
  int retval = execute_all_close_hooks(close_nothrow, fd);
#else
  int retval = close_nothrow(fd);
#endif /* WINDOWS_SOCKETS */

#if defined(REPLACE_FCHDIR) && REPLACE_FCHDIR
  if (retval >= 0) {
    _gl_unregister_fd(fd);
  }
#endif /* REPLACE_FCHDIR */

  return retval;
}