static inline void uio_StdioAccessHandle_delete(uio_StdioAccessHandle *handle) { if (handle->tempDir != NULL) uio_DirHandle_unref(handle->tempDir); if (handle->fileName != NULL) uio_free(handle->fileName); if (handle->tempRoot != NULL) uio_DirHandle_unref(handle->tempRoot); if (handle->tempDirName != NULL) uio_free(handle->tempDirName); uio_free(handle->stdioPath); uio_StdioAccessHandle_free(handle); }
void uio_releaseStdioAccess(uio_StdioAccessHandle *handle) { if (handle->tempDir != NULL) { if (uio_unlink(handle->tempDir, handle->fileName) == -1) { #ifdef DEBUG fprintf(stderr, "Error: Could not remove temporary file: " "%s\n", strerror(errno)); #endif } // Need to free this handle in advance. There should be no handles // to a dir left when removing it. uio_DirHandle_unref(handle->tempDir); handle->tempDir = NULL; if (uio_rmdir(handle->tempRoot, handle->tempDirName) == -1) { #ifdef DEBUG fprintf(stderr, "Error: Could not remove temporary directory: " "%s\n", strerror(errno)); #endif } } uio_StdioAccessHandle_delete(handle); }
int uio_closeDir(uio_DirHandle *dirHandle) { uio_DirHandle_unref(dirHandle); return 0; }