From 79d5563344d020814e384e53f1338c21e63dc8f0 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Sun, 24 Jun 2012 14:44:43 +0930 Subject: [PATCH] Fix 719d1fe72cc25ecbd73f00189595d5d1936141a4 (SOCK_DGRAM vs SOCK_STREAM) --- monitor.c | 3 ++- overlay_mdp.c | 2 +- socket.c | 4 ++-- socket.h | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/monitor.c b/monitor.c index 6c48ecf9..0cb23646 100644 --- a/monitor.c +++ b/monitor.c @@ -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; } diff --git a/overlay_mdp.c b/overlay_mdp.c index 2762cde4..7f325320 100644 --- a/overlay_mdp.c +++ b/overlay_mdp.c @@ -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; } diff --git a/socket.c b/socket.c index 2e6d36ef..0038b3a3 100644 --- a/socket.c +++ b/socket.c @@ -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) { diff --git a/socket.h b/socket.h index 0b86e70d..7d3fdb0d 100644 --- a/socket.h +++ b/socket.h @@ -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);