MCPcopy Create free account
hub / github.com/crawl/crawl / fopen_replace

Function fopen_replace

crawl-ref/source/files.cc:4028–4038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4026/////////////////////////////////////////////////////////////////////////////
4027
4028FILE *fopen_replace(const char *name)
4029{
4030 int fd;
4031
4032 // Stave off symlink attacks. Races will be handled with O_EXCL.
4033 unlink_u(name);
4034 fd = open_u(name, O_CREAT|O_EXCL|O_WRONLY, 0666);
4035 if (fd == -1)
4036 return 0;
4037 return fdopen(fd, "w");
4038}
4039
4040// Returns the size of the opened file with the give FILE* handle.
4041off_t file_size(FILE *handle)

Callers 5

dump_mapFunction · 0.85
_write_dumpFunction · 0.85
whereis_recordFunction · 0.85
LUAFNFunction · 0.85
crash_signal_handlerFunction · 0.85

Calls 2

unlink_uFunction · 0.85
open_uFunction · 0.85

Tested by

no test coverage detected