mirror of
https://github.com/fluencelabs/redis
synced 2025-06-23 14:01:34 +00:00
Added a config directive for a Unix socket mask
Added a configuration directive to allow a user to specify the permissions to be granted to the Unix socket file. I followed the format Pieter and Salvatore discusses in issue #85 ( https://github.com/antirez/redis/issues/85).
This commit is contained in:
@ -32,6 +32,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/un.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user