summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80b552c)
raw | patch | inline | side by side (parent: 80b552c)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 24 Sep 2008 22:21:21 +0000 (22:21 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Wed, 24 Sep 2008 22:21:21 +0000 (22:21 +0000) |
doc/rrdcached.pod | patch | blob | history | |
src/rrd_daemon.c | patch | blob | history |
diff --git a/doc/rrdcached.pod b/doc/rrdcached.pod
index e718791c410caa4e69a4e420960355a086000ff9..0f34dc20549b3dff4e5db5f191f0c5f973081f81 100644 (file)
--- a/doc/rrdcached.pod
+++ b/doc/rrdcached.pod
interpreted as the path to a UNIX domain socket. Otherwise the address or node
name are resolved using L<getaddrinfo>.
+For network sockets, a port may be specified by using the form
+I<address>:I<port>. The default port is 42217.
+
If the B<-l> option is not specified the default address,
C<unix:/tmp/rrdcached.sock>, will be used.
diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index 2bd19a1417038deb7e6e2c5149b625ee309fce1e..6f01f899cb8e03629257d4ed757ab63854af1753 100644 (file)
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
struct addrinfo ai_hints;
struct addrinfo *ai_res;
struct addrinfo *ai_ptr;
+ char *port;
int status;
assert (addr != NULL);
ai_hints.ai_family = AF_UNSPEC;
ai_hints.ai_socktype = SOCK_STREAM;
+ port = rindex(addr, ':');
+ if (port != NULL)
+ *port++ = '\0';
+
ai_res = NULL;
- status = getaddrinfo (addr, RRDCACHED_DEFAULT_PORT, &ai_hints, &ai_res);
+ status = getaddrinfo (addr,
+ port == NULL ? RRDCACHED_DEFAULT_PORT : port,
+ &ai_hints, &ai_res);
if (status != 0)
{
RRDD_LOG (LOG_ERR, "open_listen_socket: getaddrinfo(%s) failed: "