X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/3cd12b568776fcee3284ca692ad25e4ddce93c95..07ac2daaaa6c844cc3171c8f01ad5ad7e786e2ea:/src/anet.c diff --git a/src/anet.c b/src/anet.c index 692cef19..9aff4dfa 100644 --- a/src/anet.c +++ b/src/anet.c @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -291,7 +292,7 @@ int anetTcpServer(char *err, int port, char *bindaddr) return s; } -int anetUnixServer(char *err, char *path) +int anetUnixServer(char *err, char *path, mode_t perm) { int s; struct sockaddr_un sa; @@ -304,6 +305,8 @@ int anetUnixServer(char *err, char *path) strncpy(sa.sun_path,path,sizeof(sa.sun_path)-1); if (anetListen(err,s,(struct sockaddr*)&sa,sizeof(sa)) == ANET_ERR) return ANET_ERR; + if (perm) + chmod(sa.sun_path, perm); return s; }