follow-up bit; ensure the mkstemp() file is unlinked

This commit is contained in:
nhmall
2020-09-22 10:11:51 -04:00
parent 1a0ee44760
commit 29c558ed12

View File

@@ -416,8 +416,10 @@ int flg UNUSED;
if (istemp) {
(void) snprintf(tmpfbuf, sizeof tmpfbuf, DATA_TEMPLATE, "mdXXXXXX");
tmpfd = mkstemp(tmpfbuf);
if (tmpfd >= 0)
if (tmpfd >= 0) {
rv = fdopen(tmpfd, WRTMODE); /* temp file is always read+write */
Unlink(tmpfbuf);
}
} else
#endif
rv = fopen(name, mode);