Fix 719d1fe72cc25ecbd73f00189595d5d1936141a4 (SOCK_DGRAM vs SOCK_STREAM)

This commit is contained in:
Daniel O'Connor 2012-06-24 14:44:43 +09:30
parent 4f94f8701a
commit 79d5563344
4 changed files with 6 additions and 5 deletions

View File

@ -74,7 +74,8 @@ monitor_setup_sockets(void) {
/* ignore SIGPIPE so that we don't explode */
signal(SIGPIPE, SIG_IGN);
if ((monitor_named_socket = socket_bind(confValueGet("monitor.socket", DEFAULT_MONITOR_SOCKET_NAME), 0)) == -1) {
if ((monitor_named_socket = socket_bind(confValueGet("monitor.socket", DEFAULT_MONITOR_SOCKET_NAME),
SOCK_STREAM, 0)) == -1) {
WHY_perror("bind");
goto error;
}

View File

@ -28,7 +28,7 @@ overlay_mdp_setup_sockets(void) {
if (mdp_socket != -1)
return 0;
if ((mdp_socket = socket_bind(confValueGet("mdp.socket", DEFAULT_MDP_SOCKET_NAME), 1)) == -1) {
if ((mdp_socket = socket_bind(confValueGet("mdp.socket", DEFAULT_MDP_SOCKET_NAME), SOCK_DGRAM, 1)) == -1) {
WHY_perror("socket_bind");
goto error;
}

View File

@ -39,12 +39,12 @@
* more than one servald on a given system.
*/
int
socket_bind(const char *name, int reuse) {
socket_bind(const char *name, int type, int reuse) {
int s, oerrno, reuseP;
struct sockaddr_un sockname;
socklen_t len;
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
if ((s = socket(AF_UNIX, type, 0)) == -1)
return -1;
if (reuse) {

View File

@ -1,4 +1,4 @@
int socket_bind(const char *name, int reuse);
int socket_bind(const char *name, int type, int reuse);
void socket_setname(struct sockaddr_un *sockname, const char *name, socklen_t *len);
void socket_done(const char *name);