summaryrefslogtreecommitdiff
path: root/legacy/evas/src/bin/evas_cserve2_client.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-05-21 08:44:55 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-05-21 08:44:55 +0000
commit69bd9ce72e2ed89fec7d9dd4a81bc68d974c2823 (patch)
tree2a27a7d9661bef572007c9f0a82a3bbf08d4dfec /legacy/evas/src/bin/evas_cserve2_client.c
parent8250180aecd0524141a11cb1c7c71d157b3e08e6 (diff)
let's make server work out of the box if u set:
export EVAS_CSERVE2=1 (and run cserve2) SVN revision: 71274
Diffstat (limited to 'legacy/evas/src/bin/evas_cserve2_client.c')
-rw-r--r--legacy/evas/src/bin/evas_cserve2_client.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/legacy/evas/src/bin/evas_cserve2_client.c b/legacy/evas/src/bin/evas_cserve2_client.c
index ab5093248f..d8add9cc3d 100644
--- a/legacy/evas/src/bin/evas_cserve2_client.c
+++ b/legacy/evas/src/bin/evas_cserve2_client.c
@@ -14,6 +14,11 @@
14static const char *SOCK_PATH = "/tmp/cserve2.socket"; 14static const char *SOCK_PATH = "/tmp/cserve2.socket";
15static unsigned int _rid_count = 0; 15static unsigned int _rid_count = 0;
16 16
17static struct sockaddr_un socket_local;
18#ifndef UNIX_PATH_MAX
19#define UNIX_PATH_MAX sizeof(socket_local.sun_path)
20#endif
21
17static void 22static void
18debug_msg(const void *buf, int size) 23debug_msg(const void *buf, int size)
19{ 24{
@@ -323,7 +328,7 @@ int main(void)
323{ 328{
324 int s, t, len, skip_cmd = 0; 329 int s, t, len, skip_cmd = 0;
325 struct sockaddr_un remote; 330 struct sockaddr_un remote;
326 char msgbuf[4096]; 331 char msgbuf[4096], buf[UNIX_PATH_MAX], *env;
327 332
328 if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) 333 if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
329 { 334 {
@@ -334,7 +339,14 @@ int main(void)
334 printf("Trying to connect...\n"); 339 printf("Trying to connect...\n");
335 340
336 remote.sun_family = AF_UNIX; 341 remote.sun_family = AF_UNIX;
337 strcpy(remote.sun_path, SOCK_PATH); 342 env = getenv("EVAS_CSERVE2_SOCKET");
343 if (!env)
344 {
345 snprintf(buf, sizeof(buf), "/tmp/.evas-cserve2-%x.socket",
346 (int)getuid());
347 env = buf;
348 }
349 strncpy(remote.sun_path, env, UNIX_PATH_MAX - 1);
338 len = strlen(remote.sun_path) + sizeof(remote.sun_family); 350 len = strlen(remote.sun_path) + sizeof(remote.sun_family);
339 if (connect(s, (struct sockaddr *)&remote, len) == -1) 351 if (connect(s, (struct sockaddr *)&remote, len) == -1)
340 { 352 {