MCPcopy Create free account
hub / github.com/antirez/ds4 / agent_string_head

Function agent_string_head

ds4_agent.c:6508–6522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6506 (!(hdr.ext_flags & DS4_KVSTORE_EXT_SESSION_TITLE) ||
6507 agent_kv_write_title_trailer(fp, title, err, err_len)) &&
6508 fflush(fp) == 0;
6509 int saved_errno = errno;
6510 if (fclose(fp) != 0) {
6511 if (!saved_errno) saved_errno = errno;
6512 ok = false;
6513 }
6514 if (ok && rename(tmp, path) != 0) {
6515 saved_errno = errno;
6516 ok = false;
6517 }
6518 if (!ok) {
6519 snprintf(err, err_len, "%s",
6520 saved_errno ? strerror(saved_errno) : "failed to write stripped session");
6521 unlink(tmp);
6522 } else {
6523 if (sha_out) memcpy(sha_out, sha, 41);
6524 if (tokens_out) *tokens_out = stripped_token_count;
6525 }

Callers 1

agent_tool_visit_pageFunction · 0.85

Calls 2

xstrdupFunction · 0.70
xstrndupFunction · 0.70

Tested by

no test coverage detected