forked from enlightenment/efl
let's make server work out of the box if u set:
export EVAS_CSERVE2=1 (and run cserve2) SVN revision: 71274
This commit is contained in:
parent
8250180aec
commit
69bd9ce72e
|
@ -14,6 +14,11 @@
|
||||||
static const char *SOCK_PATH = "/tmp/cserve2.socket";
|
static const char *SOCK_PATH = "/tmp/cserve2.socket";
|
||||||
static unsigned int _rid_count = 0;
|
static unsigned int _rid_count = 0;
|
||||||
|
|
||||||
|
static struct sockaddr_un socket_local;
|
||||||
|
#ifndef UNIX_PATH_MAX
|
||||||
|
#define UNIX_PATH_MAX sizeof(socket_local.sun_path)
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
debug_msg(const void *buf, int size)
|
debug_msg(const void *buf, int size)
|
||||||
{
|
{
|
||||||
|
@ -323,7 +328,7 @@ int main(void)
|
||||||
{
|
{
|
||||||
int s, t, len, skip_cmd = 0;
|
int s, t, len, skip_cmd = 0;
|
||||||
struct sockaddr_un remote;
|
struct sockaddr_un remote;
|
||||||
char msgbuf[4096];
|
char msgbuf[4096], buf[UNIX_PATH_MAX], *env;
|
||||||
|
|
||||||
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
|
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
|
||||||
{
|
{
|
||||||
|
@ -334,7 +339,14 @@ int main(void)
|
||||||
printf("Trying to connect...\n");
|
printf("Trying to connect...\n");
|
||||||
|
|
||||||
remote.sun_family = AF_UNIX;
|
remote.sun_family = AF_UNIX;
|
||||||
strcpy(remote.sun_path, SOCK_PATH);
|
env = getenv("EVAS_CSERVE2_SOCKET");
|
||||||
|
if (!env)
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "/tmp/.evas-cserve2-%x.socket",
|
||||||
|
(int)getuid());
|
||||||
|
env = buf;
|
||||||
|
}
|
||||||
|
strncpy(remote.sun_path, env, UNIX_PATH_MAX - 1);
|
||||||
len = strlen(remote.sun_path) + sizeof(remote.sun_family);
|
len = strlen(remote.sun_path) + sizeof(remote.sun_family);
|
||||||
if (connect(s, (struct sockaddr *)&remote, len) == -1)
|
if (connect(s, (struct sockaddr *)&remote, len) == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -207,6 +207,11 @@ _socket_path_set(char *path)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "/tmp/.evas-cserve2-%x.socket", (int)getuid());
|
||||||
|
/* FIXME: check we can actually create this socket */
|
||||||
|
strcpy(path, buf);
|
||||||
|
return;
|
||||||
|
#if 0
|
||||||
env = getenv("XDG_RUNTIME_DIR");
|
env = getenv("XDG_RUNTIME_DIR");
|
||||||
if (!env || !env[0])
|
if (!env || !env[0])
|
||||||
{
|
{
|
||||||
|
@ -222,6 +227,7 @@ _socket_path_set(char *path)
|
||||||
snprintf(buf, sizeof(buf), "%s/evas-cserve2-%x.socket", env, getuid());
|
snprintf(buf, sizeof(buf), "%s/evas-cserve2-%x.socket", env, getuid());
|
||||||
/* FIXME: check we can actually create this socket */
|
/* FIXME: check we can actually create this socket */
|
||||||
strcpy(path, buf);
|
strcpy(path, buf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -58,6 +58,10 @@ _socket_path_set(char *path)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "/tmp/.evas-cserve2-%x.socket", (int)getuid());
|
||||||
|
/* FIXME: check we can actually create this socket */
|
||||||
|
strcpy(path, buf);
|
||||||
|
#if 0
|
||||||
env = getenv("XDG_RUNTIME_DIR");
|
env = getenv("XDG_RUNTIME_DIR");
|
||||||
if (!env || !env[0])
|
if (!env || !env[0])
|
||||||
{
|
{
|
||||||
|
@ -73,6 +77,7 @@ _socket_path_set(char *path)
|
||||||
snprintf(buf, sizeof(buf), "%s/evas-cserve2-%x.socket", env, getuid());
|
snprintf(buf, sizeof(buf), "%s/evas-cserve2-%x.socket", env, getuid());
|
||||||
/* FIXME: check we can actually create this socket */
|
/* FIXME: check we can actually create this socket */
|
||||||
strcpy(path, buf);
|
strcpy(path, buf);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
|
Loading…
Reference in New Issue