FileClose
Description
Close a file we opened via FileOpen. Idempotent and safe on a borrowed (owns == false) handle; in that case it just clears the local state without touching the underlying fd / HANDLE.
Success
Returns true.
Failure
Returns false if the close syscall failed (logged).
Usage example (Cross-references)
Usage examples (Cross-references)
- In
PdbCache.c:28:
return false;
}
FileClose(&f);
return true;
}- In
MachoCache.c:27:
return false;
}
FileClose(&f);
return true;
} return false;
}
FileClose(&f);
return true;
}- In
ProcMaps.c:185:
if (!StrReserve(&out->raw, grown_to)) {
LOG_ERROR("ProcMapsLoad: failed to grow buffer");
FileClose(&f);
ProcMapsDeinit(out);
return false;- In
ProcMaps.c:192:
if (n < 0) {
LOG_ERROR("ProcMapsLoad: FileRead failed");
FileClose(&f);
ProcMapsDeinit(out);
return false;- In
ProcMaps.c:200:
break; // EOF
}
FileClose(&f);
if (out->raw.length == 0) {
LOG_ERROR("ProcMapsLoad: /proc/self/maps was empty");- In
File.c:183:
}
bool FileClose(File *f) {
if (!f) {
return false;- In
File.c:389:
i64 got = FileRead(&f, buffer, (u64)fsize);
FileClose(&f);
if (got != fsize) {
LOG_ERROR("read_complete_file: short read on \"{}\" (got {} of {})", filename, got, fsize);- In
File.h:44:
#endif
bool at_eof; // last read returned 0 bytes
bool owns; // true when FileClose should release the handle
} File;- In
ElfInfo.c:424:
VecDeinit(&vi);
FileClose(&elf);
DefaultAllocatorDeinit(&alloc);
return 0;
Last updated on