MCPcopy Create free account
hub / github.com/corosync/corosync / sam_parent_data_store

Function sam_parent_data_store

lib/sam.c:1046–1093  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1044}
1045
1046static cs_error_t sam_parent_data_store (
1047 int parent_fd_in,
1048 int parent_fd_out)
1049{
1050 char *user_data;
1051 ssize_t size;
1052 cs_error_t err;
1053
1054 err = CS_OK;
1055 user_data = NULL;
1056
1057 if (sam_safe_read (parent_fd_in, &size, sizeof (size)) != sizeof (size)) {
1058 err = CS_ERR_LIBRARY;
1059 goto error_reply;
1060 }
1061
1062 if (size >= SSIZE_MAX) {
1063 err = CS_ERR_TOO_BIG;
1064 goto error_reply;
1065 }
1066
1067 if (size > 0) {
1068 user_data = malloc (size);
1069 if (user_data == NULL) {
1070 err = CS_ERR_NO_MEMORY;
1071 goto error_reply;
1072 }
1073
1074 if (sam_safe_read (parent_fd_in, user_data, size) != size) {
1075 err = CS_ERR_LIBRARY;
1076 goto free_error_reply;
1077 }
1078 }
1079
1080 err = sam_data_store_nolock (user_data, size);
1081 if (err != CS_OK) {
1082 goto free_error_reply;
1083 }
1084
1085 free (user_data);
1086
1087 return (sam_parent_reply_send (CS_OK, parent_fd_in, parent_fd_out));
1088
1089free_error_reply:
1090 free (user_data);
1091error_reply:
1092 return (sam_parent_reply_send (err, parent_fd_in, parent_fd_out));
1093}
1094
1095static enum sam_parent_action_t sam_parent_handler (
1096 int parent_fd_in,

Callers 1

sam_parent_handlerFunction · 0.85

Calls 3

sam_safe_readFunction · 0.85
sam_data_store_nolockFunction · 0.85
sam_parent_reply_sendFunction · 0.85

Tested by

no test coverage detected