summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con
diff options
context:
space:
mode:
authorSrivardhan Hebbar <sri.hebbar@samsung.com>2015-03-18 15:33:19 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-03-18 15:37:09 +0100
commitb1f74c615a57115933ba86ca63bc2da7f3d44f0c (patch)
treec5abab717b1b9269cd6b6fb9f787df1cc38109eb /src/lib/ecore_con
parent4c0f37b93ce143d90d4557680c5c50a331217d0a (diff)
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>
Diffstat (limited to 'src/lib/ecore_con')
-rw-r--r--src/lib/ecore_con/ecore_con_local.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c
index 2992058ee1..9af5ca56f1 100644
--- a/src/lib/ecore_con/ecore_con_local.c
+++ b/src/lib/ecore_con/ecore_con_local.c
@@ -119,14 +119,11 @@ ecore_con_local_connect(Ecore_Con_Server *obj,
119 } 119 }
120 else 120 else
121 { 121 {
122 if (svr->name[0] == 122 if (svr->name[0] == '/')
123 '/') 123 snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
124 snprintf(buf, sizeof(buf), "%s|%i", svr->name,
125 svr->port);
126 else 124 else
127 snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i", 125 snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i",
128 svr->name, 126 svr->name, svr->port);
129 svr->port);
130 } 127 }
131 } 128 }
132 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) 129 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
@@ -273,26 +270,24 @@ ecore_con_local_listen(
273 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM) 270 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)
274 { 271 {
275 mask = 0; 272 mask = 0;
276 if (svr->name[0] == '/') 273 if (svr->port < 0)
277 { 274 {
278 if (svr->port >= 0) 275 if (svr->name[0] == '/')
279 snprintf(buf, 276 {
280 sizeof(buf), 277 strncpy(buf, svr->name, sizeof(buf) - 1);
281 "%s|%i", 278 buf[sizeof(buf) - 1] = 0;
282 svr->name, 279 }
283 svr->port);
284 else 280 else
285 snprintf(buf, 281 snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s", svr->name);
286 sizeof(buf),
287 "%s",
288 svr->name);
289 } 282 }
290 else 283 else
291 snprintf(buf, 284 {
292 sizeof(buf), 285 if (svr->name[0] == '/')
293 "/tmp/.ecore_service|%s|%i", 286 snprintf(buf, sizeof(buf), "%s|%i", svr->name, svr->port);
294 svr->name, 287 else
295 svr->port); 288 snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i",
289 svr->name, svr->port);
290 }
296 } 291 }
297 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) 292 else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT)
298 { 293 {