Closed Aidearn closed 4 years ago
yar_client yar_client_init(char hostname) / {{{ / { struct sockaddr sa; int sockfd; yar_client *client = calloc(1, sizeof(yar_client));
client->hostname = hostname; client->call = yar_client_caller; if (strncasecmp(hostname, "http://", sizeof("http://")) == 0 || strncasecmp(hostname, "https://", sizeof("https://")) == 0) { /* libcurl */ free(client); return NULL; } else if (hostname[0] == '/') { /* unix domain socket */ struct sockaddr_un *usa; usa = (struct sockaddr_un *)&sa; // 应该是:if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) { if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0) == -1)) { alog(YAR_ERROR, "Failed to create a socket '%s'", strerror(errno)); free(client); return NULL; } usa->sun_family = AF_UNIX; memcpy(usa->sun_path, hostname, strlen(hostname) + 1);
提个pr吧?
fixed
yar_client yar_client_init(char hostname) / {{{ / { struct sockaddr sa; int sockfd; yar_client *client = calloc(1, sizeof(yar_client));