From: Felix Morgner Date: Tue, 29 Apr 2014 05:39:44 +0000 (+0200) Subject: Fixed errors in address generation X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=237334f63049d15450ea95197bc68f89a421e44a;p=umurmur.git Fixed errors in address generation --- diff --git a/src/conf.c b/src/conf.c index a93031f..d716312 100644 --- a/src/conf.c +++ b/src/conf.c @@ -144,23 +144,23 @@ const char *getStrConf(param_t param) case BINDADDR: setting = config_lookup(&configuration, "bindaddr"); if (!setting) - return ""; + return NULL; else { if ((strsetting = config_setting_get_string(setting)) != NULL) return strsetting; else - return ""; + return NULL; } break; case BINDADDR6: setting = config_lookup(&configuration, "bindaddr6"); if (!setting) - return ""; + return NULL; else { if ((strsetting = config_setting_get_string(setting)) != NULL) return strsetting; else - return ""; + return NULL; } break; case WELCOMETEXT: diff --git a/src/server.c b/src/server.c index 827b99b..5394b09 100644 --- a/src/server.c +++ b/src/server.c @@ -64,7 +64,7 @@ extern int bindport6; struct sockaddr_storage** Server_setupAddressesAndPorts() { - struct sockaddr_storage** addresses; + struct sockaddr_storage** addresses = malloc(2 * sizeof(void*)); struct sockaddr_storage* v4address = calloc(1, sizeof(struct sockaddr_storage)); v4address->ss_family = AF_INET; @@ -79,7 +79,7 @@ struct sockaddr_storage** Server_setupAddressesAndPorts() : bindaddr, &(((struct sockaddr_in*)v4address)->sin_addr)); if (error == 0) Log_fatal("Invalid IPv4 address supplied!"); - error = inet_pton(AF_INET, (!bindaddr6) ? ((getStrConf(BINDADDR6)) ? getStrConf(BINDADDR6) : "::") + error = inet_pton(AF_INET6, (!bindaddr6) ? ((getStrConf(BINDADDR6)) ? getStrConf(BINDADDR6) : "::") : bindaddr6, &(((struct sockaddr_in6*)v6address)->sin6_addr)); if (error == 0) Log_fatal("Invalid IPv6 address supplied!");