/** * The close function loses the file with descriptor identifier in FS. */ int pcsl_file_close(void *handle) { if (NULL == handle) return -1; { PCSLFile* pFH = (PCSLFile*)handle; pcsl_file_commitwrite(handle); /* commit pending writes */ if (!CloseHandle(pFH->fileHandle)) return -1; pcsl_mem_free(handle); return 0; } }
/* * Commit or flush pending writes * * If not successful *ppszError will set to point to an error string, * on success it will be set to NULL. */ void storageCommitWrite(char** ppszError, int handle) { int status; REPORT_INFO1(LC_CORE, "trying to flush pending writes on file handle %d\n", handle); status = pcsl_file_commitwrite((void *)handle); if (status < 0) { *ppszError = getLastError("storageCommit()"); return; } *ppszError = NULL; }
/** * The close function loses the file with descriptor identifier in FS. */ int pcsl_file_close(void *handle) { pcsl_file_commitwrite(handle); /* commit pending writes */ return _close((int)handle); }