MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_mkstemp

Function cbm_mkstemp

src/foundation/compat.c:92–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90
91#ifdef _WIN32
92int cbm_mkstemp(char *tmpl) {
93 /* Rewrite /tmp/ to %TEMP%\ like cbm_mkdtemp */
94 static char buf[CBM_SZ_512];
95 if (strncmp(tmpl, "/tmp/", 5) == 0) {
96 const char *tmp = getenv("TEMP");
97 if (!tmp)
98 tmp = getenv("TMP");
99 if (!tmp)
100 tmp = ".";
101 snprintf(buf, sizeof(buf), "%s\\%s", tmp, tmpl + 5);
102 } else {
103 snprintf(buf, sizeof(buf), "%s", tmpl);
104 }
105 if (!_mktemp(buf))
106 return CBM_NOT_FOUND;
107 int fd = _open(buf, _O_CREAT | _O_RDWR | _O_BINARY, _S_IREAD | _S_IWRITE);
108 if (fd >= 0)
109 strcpy(tmpl, buf);
110 return fd;
111}
112#endif
113
114/* ── clock_gettime (Windows lacks it) ─────────────────────────── */

Callers 2

sha256_vector_okFunction · 0.85
make_temp_dbFunction · 0.85

Calls

no outgoing calls

Tested by 2

sha256_vector_okFunction · 0.68
make_temp_dbFunction · 0.68