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