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

Function posix_socket_path_identity_read

src/daemon/ipc.c:2509–2528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2507}
2508
2509static int posix_socket_path_identity_read(const cbm_daemon_ipc_endpoint_t *endpoint,
2510 const char *socket_name,
2511 posix_socket_identity_t *identity_out,
2512 struct stat *status_out) {
2513 struct stat status;
2514 if (!endpoint || !socket_name || !identity_out) {
2515 return -1;
2516 }
2517 if (fstatat(endpoint->dir_fd, socket_name, &status, AT_SYMLINK_NOFOLLOW) != 0) {
2518 return errno == ENOENT ? 0 : -1;
2519 }
2520 if (!posix_socket_status_secure_transport(&status) ||
2521 !posix_socket_identity_from_stat(&status, identity_out)) {
2522 return -1;
2523 }
2524 if (status_out) {
2525 *status_out = status;
2526 }
2527 return 1;
2528}
2529
2530static bool posix_path_unlink_regular_if_matches(int dir_fd, const char *name, dev_t device,
2531 ino_t inode, nlink_t links) {

Tested by

no test coverage detected