setting permissions on socket

This commit is contained in:
Jan Losinshi 2008-08-26 18:40:23 +02:00
parent ce2889c9f1
commit e46ab74e6e
2 changed files with 7 additions and 0 deletions

View File

@ -317,6 +317,7 @@ namespace xerxes
memset(&adr, 0, sizeof(adr));
adr.sun_family = AF_UNIX;
strncpy(adr.sun_path, opt.file.c_str(), sizeof(adr.sun_path));
return bind(socket, (struct sockaddr *) &adr, SUN_LEN(&adr));
}

View File

@ -8,6 +8,7 @@
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netdb.h>
#include <signal.h>
@ -106,6 +107,11 @@ main(int argc, char* argv[])
listen(lstn, 3);
if(src.type == UNIX)
{
chmod(src.file.c_str(), 0777);
}
EPoll epoll;
epoll.add(lstn);