MCPcopy Create free account
hub / github.com/clementgallet/libTAS / closeFile

Method closeFile

src/library/fileio/SaveFile.cpp:395–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393}
394
395int SaveFile::closeFile()
396{
397 if (closed) {
398 errno = EBADF;
399 return -1;
400 }
401
402 closed = true;
403
404 /* If the file wasn't removed, do nothing */
405 if (!removed)
406 return 0;
407
408 if (stream) {
409 NATIVECALL(fclose(stream)); // closes both the stream and fd
410 stream = nullptr;
411 fd = 0;
412 }
413 else if (fd != 0) {
414 NATIVECALL(close(fd));
415 fd = 0;
416 }
417
418 return 0;
419}
420
421int SaveFile::remove()
422{

Callers 1

closeSaveFileFunction · 0.80

Calls 2

fcloseFunction · 0.85
closeFunction · 0.85

Tested by

no test coverage detected