我正在做以下事情
auto tempFd = mkstemp(filePathTemplate);
// 1) write to temp file, on error, unlink()
// 2) sync temp file, on error, unlink()
// 3) close temp file, on error, unlink()
// 4) rename to implement an atomic write, on error unlink()
在这里,如果程序在步骤(4)完全完成之前的任何地方崩溃,但在取消链接执行之前会发生什么?如果经常发生这样的崩溃,临时文件是否会无限制地积累起来?如果是这样,有什么办法可以在程序不断循环崩溃的情况下避免这种文件的积累?