From 4fe83b554ac1b16ddad559df788b80d4864310e1 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Wed, 13 Oct 2010 18:50:07 +0200 Subject: [PATCH] sockaddr_un.sun_path appears to never hold anything after accept() --- src/anet.c | 6 +----- src/anet.h | 2 +- src/networking.c | 3 +-- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/anet.c b/src/anet.c index 99cda011..e7763e4c 100644 --- a/src/anet.c +++ b/src/anet.c @@ -336,16 +336,12 @@ int anetTcpAccept(char *err, int s, char *ip, int *port) { return fd; } -int anetUnixAccept(char *err, int s, char *path, int len) { +int anetUnixAccept(char *err, int s) { int fd; struct sockaddr_un sa; socklen_t salen = sizeof(sa); if ((fd = anetGenericAccept(err,s,(struct sockaddr*)&sa,&salen)) == ANET_ERR) return ANET_ERR; - if (path) { - strncpy(path,sa.sun_path,len-1); - path[len-1] = 0; - } return fd; } diff --git a/src/anet.h b/src/anet.h index 45a89464..bef0adcf 100644 --- a/src/anet.h +++ b/src/anet.h @@ -44,7 +44,7 @@ int anetResolve(char *err, char *host, char *ipbuf); int anetTcpServer(char *err, int port, char *bindaddr); int anetUnixServer(char *err, char *path); int anetTcpAccept(char *err, int serversock, char *ip, int *port); -int anetUnixAccept(char *err, int serversock, char *path, int len); +int anetUnixAccept(char *err, int serversock); int anetWrite(int fd, char *buf, int count); int anetNonBlock(char *err, int fd); int anetTcpNoDelay(char *err, int fd); diff --git a/src/networking.c b/src/networking.c index ae772c92..4e93186e 100644 --- a/src/networking.c +++ b/src/networking.c @@ -199,12 +199,11 @@ void acceptTcpHandler(aeEventLoop *el, int fd, void *privdata, int mask) { void acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask) { int cfd; - char cpath[128]; REDIS_NOTUSED(el); REDIS_NOTUSED(mask); REDIS_NOTUSED(privdata); - cfd = anetUnixAccept(server.neterr, fd, cpath, sizeof(cpath)); + cfd = anetUnixAccept(server.neterr, fd); if (cfd == AE_ERR) { redisLog(REDIS_VERBOSE,"Accepting client connection: %s", server.neterr); return; -- 2.45.2