forked from enlightenment/efl
small change to something never used/tested much ... cserve2 - FAIL if
an existing cserve 2 client is there. SVN revision: 83866
This commit is contained in:
parent
495bcba4ac
commit
5fa5f1430b
|
@ -253,13 +253,22 @@ _socketfd_setup(void)
|
||||||
socket_local.sun_family = AF_UNIX;
|
socket_local.sun_family = AF_UNIX;
|
||||||
_socket_path_set(socket_local.sun_path);
|
_socket_path_set(socket_local.sun_path);
|
||||||
DBG("Using '%s' as server socket.", 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);
|
len = strlen(socket_local.sun_path) + sizeof(socket_local.sun_family);
|
||||||
if (bind(s, (struct sockaddr *)&socket_local, len) == -1)
|
if (bind(s, (struct sockaddr *)&socket_local, len) == -1)
|
||||||
{
|
{
|
||||||
ERR("Could not bind socketfd: \"%s\"", strerror(errno));
|
if (connect(s, (struct sockaddr *)&socket_local, len) != -1)
|
||||||
close(s);
|
{
|
||||||
return -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)
|
if (listen(s, MAX_INCOMING_CONN) == -1)
|
||||||
|
|
Loading…
Reference in New Issue