forked from enlightenment/efl
ecore_con: fix ECORE_CON_LOCAL_SYSTEM use with negative port number.
Summary: The socket can be created even with negative port number, but in that case the port is ignored so that you can connect to non Ecore_Con based IPC. This patch remove that test to make the client and server match. @fix Bug: While creating ECORE_CON_LOCAL_SYSTEM server and client pair, when the socket name was "test_socket" and port number "-8" (Any negative number). Then while creating listening socket, the code would go to line no 291 and socket is created in tmp by ".ecore_servicetest_socket|-8". When the same is passed to bind then the code would go to line 118 and the socket it would try to bind would be ".ecore_servicetest_socket" !! So the bind would fail. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2186 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
4c0f37b93c
commit
b1f74c615a
|
@ -119,14 +119,11 @@ ecore_con_local_connect(Ecore_Con_Server *obj,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (svr->name[0] ==
|
||||
'/')
|
||||
snprintf(buf, sizeof(buf), "%s|%i", svr->name,
|
||||
svr->port);
|
||||
if (svr->name[0] == '/')
|
||||
snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i",
|
||||
svr->name,
|
||||
svr->port);
|
||||
svr->name, svr->port);
|
||||
}
|
||||
}
|
||||
else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
|
||||
|
@ -273,26 +270,24 @@ ecore_con_local_listen(
|
|||
else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
|
||||
{
|
||||
mask = 0;
|
||||
if (svr->name[0] == '/')
|
||||
if (svr->port < 0)
|
||||
{
|
||||
if (svr->port >= 0)
|
||||
snprintf(buf,
|
||||
sizeof(buf),
|
||||
"%s|%i",
|
||||
svr->name,
|
||||
svr->port);
|
||||
if (svr->name[0] == '/')
|
||||
{
|
||||
strncpy(buf, svr->name, sizeof(buf) - 1);
|
||||
buf[sizeof(buf) - 1] = 0;
|
||||
}
|
||||
else
|
||||
snprintf(buf,
|
||||
sizeof(buf),
|
||||
"%s",
|
||||
svr->name);
|
||||
snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s", svr->name);
|
||||
}
|
||||
else
|
||||
snprintf(buf,
|
||||
sizeof(buf),
|
||||
"/tmp/.ecore_service|%s|%i",
|
||||
svr->name,
|
||||
svr->port);
|
||||
{
|
||||
if (svr->name[0] == '/')
|
||||
snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i",
|
||||
svr->name, svr->port);
|
||||
}
|
||||
}
|
||||
else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue