Check whether reply is NULL or its type is REDIS_REPLY_ERROR. In the * latest case, if the 'err' arg is not NULL, it gets allocated with a copy * of reply error (it's up to the caller function to free it), elsewhere * the error is directly printed. */
| 2761 | * of reply error (it's up to the caller function to free it), elsewhere |
| 2762 | * the error is directly printed. */ |
| 2763 | static int clusterManagerCheckRedisReply(clusterManagerNode *n, |
| 2764 | redisReply *r, char **err) |
| 2765 | { |
| 2766 | int is_err = 0; |
| 2767 | if (!r || (is_err = (r->type == REDIS_REPLY_ERROR))) { |
| 2768 | if (is_err) { |
| 2769 | if (err != NULL) { |
| 2770 | *err = zmalloc((r->len + 1) * sizeof(char)); |
| 2771 | strcpy(*err, r->str); |
| 2772 | } else CLUSTER_MANAGER_PRINT_REPLY_ERROR(n, r->str); |
| 2773 | } |
| 2774 | return 0; |
| 2775 | } |
| 2776 | return 1; |
| 2777 | } |
| 2778 | |
| 2779 | /* Call MULTI command on a cluster node. */ |
| 2780 | static int clusterManagerStartTransaction(clusterManagerNode *node) { |
no test coverage detected