summaryrefslogtreecommitdiff
path: root/src/bin/evas/evas_cserve2_main_loop_linux.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2013-02-13 11:32:30 +0000
committerCarsten Haitzler <raster@rasterman.com>2013-02-13 11:32:30 +0000
commit5fa5f1430b883a9c9944ca332c127cc1ee7970da (patch)
treeaf9ea8ce38fb53d32a37062437f7ee1676d3af91 /src/bin/evas/evas_cserve2_main_loop_linux.c
parent495bcba4ace68443b9a6ef2cc8f68bc90944ba31 (diff)
small change to something never used/tested much ... cserve2 - FAIL if
an existing cserve 2 client is there. SVN revision: 83866
Diffstat (limited to 'src/bin/evas/evas_cserve2_main_loop_linux.c')
-rw-r--r--src/bin/evas/evas_cserve2_main_loop_linux.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/bin/evas/evas_cserve2_main_loop_linux.c b/src/bin/evas/evas_cserve2_main_loop_linux.c
index afd678ee3e..0fd40ea942 100644
--- a/src/bin/evas/evas_cserve2_main_loop_linux.c
+++ b/src/bin/evas/evas_cserve2_main_loop_linux.c
@@ -253,13 +253,22 @@ _socketfd_setup(void)
253 socket_local.sun_family = AF_UNIX; 253 socket_local.sun_family = AF_UNIX;
254 _socket_path_set(socket_local.sun_path); 254 _socket_path_set(socket_local.sun_path);
255 DBG("Using '%s' as server socket.", socket_local.sun_path); 255 DBG("Using '%s' as server socket.", socket_local.sun_path);
256 unlink(socket_local.sun_path);
257 len = strlen(socket_local.sun_path) + sizeof(socket_local.sun_family); 256 len = strlen(socket_local.sun_path) + sizeof(socket_local.sun_family);
258 if (bind(s, (struct sockaddr *)&socket_local, len) == -1) 257 if (bind(s, (struct sockaddr *)&socket_local, len) == -1)
259 { 258 {
260 ERR("Could not bind socketfd: \"%s\"", strerror(errno)); 259 if (connect(s, (struct sockaddr *)&socket_local, len) != -1)
261 close(s); 260 {
262 return -1; 261 ERR("cserve2 service already there: \"%s\"", strerror(errno));
262 close(s);
263 return -1;
264 }
265 unlink(socket_local.sun_path);
266 if (bind(s, (struct sockaddr *)&socket_local, len) == -1)
267 {
268 ERR("Could not bind socketfd: \"%s\"", strerror(errno));
269 close(s);
270 return -1;
271 }
263 } 272 }
264 273
265 if (listen(s, MAX_INCOMING_CONN) == -1) 274 if (listen(s, MAX_INCOMING_CONN) == -1)