summaryrefslogtreecommitdiff
path: root/pullreqd.c
diff options
context:
space:
mode:
Diffstat (limited to 'pullreqd.c')
-rw-r--r--pullreqd.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/pullreqd.c b/pullreqd.c
index a00d85c..f077a50 100644
--- a/pullreqd.c
+++ b/pullreqd.c
@@ -109,15 +109,8 @@ int init_socket(config *cfg) {
sock_addr.sa_un.sun_family = sock_type;
memcpy(sock_addr.sa_un.sun_path, cfg->sock, path_length+1);
} else {
- if (cfg->port <= 0 || cfg->port > 65535) {
- syslog(LOG_ERR, "Invalid port %d. (Valid port must be between 1, and 65535.)", cfg->port);
- return -1;
- }
struct addrinfo hints, *ainfo_root, *ainfo;
- const size_t size = snprintf(NULL, 0, "%d", cfg->port) + 1;
- char *port_str = malloc(size);
- sprintf(port_str, "%d", cfg->port);
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
@@ -125,7 +118,7 @@ int init_socket(config *cfg) {
/*hints.ai_protocol = IPPROTO_SCTP;*/
hints.ai_flags = AI_PASSIVE;
- const int gai_ret = getaddrinfo(cfg->sock, port_str, &hints, &ainfo_root);
+ const int gai_ret = getaddrinfo(cfg->sock, cfg->port, &hints, &ainfo_root);
/* Did getaddrinfo fail? */
if (gai_ret) {
syslog(LOG_ERR, "getaddrinfo() failed for hostname %s. Reason: %s", cfg->sock, gai_strerror(gai_ret));