Logo Search packages:      
Sourcecode: samba-doc-ja version File versions

int smbc_closedir ( int  dh  ) 

Close a directory handle opened by smbc_opendir().

Parameters:
dh Directory handle to close
Returns:
0 on success, < 0 on error with errno set:
  • EBADF dh is an invalid directory handle
See also:
smbc_opendir()

Definition at line 1843 of file libsmbclient.c.

Referenced by smbc_close().

{
      struct smbc_file *fe;

      if (!smbc_initialized) {

            errno = EINVAL;
            return -1;

      }

      if (fd < smbc_start_fd || fd >= (smbc_start_fd + SMBC_MAX_FD)) {

            errno = EBADF;
            return -1;
    
      }

      fe = smbc_file_table[fd - smbc_start_fd];

      if (!fe) {

            errno = EBADF;  
            return -1;

      }

      smbc_remove_dir(fe); /* Clean it up */

      if (fe) {

            SAFE_FREE(fe->fname);
            SAFE_FREE(fe);    /* Free the space too */

      }

      smbc_file_table[fd - smbc_start_fd] = NULL;

      return 0;

}


Generated by  Doxygen 1.6.0   Back to index