diff options
author | Carsten Haitzler <raster@rasterman.com> | 2013-02-13 11:32:30 +0000 |
---|---|---|
committer | Carsten Haitzler <raster@rasterman.com> | 2013-02-13 11:32:30 +0000 |
commit | 5fa5f1430b883a9c9944ca332c127cc1ee7970da (patch) | |
tree | af9ea8ce38fb53d32a37062437f7ee1676d3af91 /src/bin | |
parent | 495bcba4ace68443b9a6ef2cc8f68bc90944ba31 (diff) | |
download | efl-5fa5f1430b883a9c9944ca332c127cc1ee7970da.tar.gz |
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')
-rw-r--r-- | src/bin/evas/evas_cserve2_main_loop_linux.c | 17 |
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) socket_local.sun_family = AF_UNIX; _socket_path_set(socket_local.sun_path); DBG("Using '%s' as server socket.", socket_local.sun_path); - unlink(socket_local.sun_path); len = strlen(socket_local.sun_path) + sizeof(socket_local.sun_family); if (bind(s, (struct sockaddr *)&socket_local, len) == -1) { - ERR("Could not bind socketfd: \"%s\"", strerror(errno)); - close(s); - return -1; + if (connect(s, (struct sockaddr *)&socket_local, len) != -1) + { + ERR("cserve2 service already there: \"%s\"", strerror(errno)); + close(s); + return -1; + } + unlink(socket_local.sun_path); + if (bind(s, (struct sockaddr *)&socket_local, len) == -1) + { + ERR("Could not bind socketfd: \"%s\"", strerror(errno)); + close(s); + return -1; + } } if (listen(s, MAX_INCOMING_CONN) == -1) |