forked from enlightenment/efl
cleaner handling of optional features
SVN revision: 26084
This commit is contained in:
parent
64386aa44c
commit
feeca8301b
|
@ -74,8 +74,8 @@ extern "C" {
|
||||||
ECORE_CON_LOCAL_USER,
|
ECORE_CON_LOCAL_USER,
|
||||||
ECORE_CON_LOCAL_SYSTEM,
|
ECORE_CON_LOCAL_SYSTEM,
|
||||||
ECORE_CON_LOCAL_ABSTRACT,
|
ECORE_CON_LOCAL_ABSTRACT,
|
||||||
ECORE_CON_REMOTE_SYSTEM
|
ECORE_CON_REMOTE_SYSTEM,
|
||||||
,ECORE_CON_USE_SSL = 16
|
ECORE_CON_USE_SSL = 16
|
||||||
} Ecore_Con_Type;
|
} Ecore_Con_Type;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -171,11 +171,8 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((type == ECORE_CON_LOCAL_USER) ||
|
if ((type == ECORE_CON_LOCAL_USER) ||
|
||||||
(type == ECORE_CON_LOCAL_SYSTEM)
|
(type == ECORE_CON_LOCAL_SYSTEM) ||
|
||||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
(type == ECORE_CON_LOCAL_ABSTRACT))
|
||||||
|| (type == ECORE_CON_LOCAL_ABSTRACT)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const char *homedir;
|
const char *homedir;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
@ -236,24 +233,25 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
socket_unix.sun_family = AF_UNIX;
|
socket_unix.sun_family = AF_UNIX;
|
||||||
#ifdef HAVE_ABSTRACT_SOCKET
|
|
||||||
if (type == ECORE_CON_LOCAL_ABSTRACT)
|
if (type == ECORE_CON_LOCAL_ABSTRACT)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ABSTRACT_SOCKET
|
||||||
/* . is a placeholder */
|
/* . is a placeholder */
|
||||||
snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name);
|
snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name);
|
||||||
/* first char null indicates abstract namespace */
|
/* first char null indicates abstract namespace */
|
||||||
socket_unix.sun_path[0] = '\0';
|
socket_unix.sun_path[0] = '\0';
|
||||||
socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name);
|
socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "Your system does not support abstract sockets!\n");
|
||||||
|
umask(pmode);
|
||||||
|
goto error;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
|
strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
|
||||||
socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
|
socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
|
|
||||||
socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
|
|
||||||
#endif
|
|
||||||
if (bind(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0)
|
if (bind(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0)
|
||||||
{
|
{
|
||||||
if (connect(svr->fd, (struct sockaddr *)&socket_unix,
|
if (connect(svr->fd, (struct sockaddr *)&socket_unix,
|
||||||
|
@ -425,11 +423,8 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
|
||||||
if ((type == ECORE_CON_REMOTE_SYSTEM) && (port < 0)) return NULL;
|
if ((type == ECORE_CON_REMOTE_SYSTEM) && (port < 0)) return NULL;
|
||||||
|
|
||||||
if ((type == ECORE_CON_LOCAL_USER) ||
|
if ((type == ECORE_CON_LOCAL_USER) ||
|
||||||
(type == ECORE_CON_LOCAL_SYSTEM)
|
(type == ECORE_CON_LOCAL_SYSTEM) ||
|
||||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
(type == ECORE_CON_LOCAL_ABSTRACT))
|
||||||
|| (type == ECORE_CON_LOCAL_ABSTRACT)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const char *homedir;
|
const char *homedir;
|
||||||
int socket_unix_len;
|
int socket_unix_len;
|
||||||
|
@ -465,23 +460,23 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
|
||||||
if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)) < 0) goto error;
|
if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, &curstate, sizeof(curstate)) < 0) goto error;
|
||||||
socket_unix.sun_family = AF_UNIX;
|
socket_unix.sun_family = AF_UNIX;
|
||||||
|
|
||||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
|
||||||
if (type == ECORE_CON_LOCAL_ABSTRACT)
|
if (type == ECORE_CON_LOCAL_ABSTRACT)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ABSTRACT_SOCKETS
|
||||||
/* copy name insto sun_path, prefixed by null to indicate abstract namespace */
|
/* copy name insto sun_path, prefixed by null to indicate abstract namespace */
|
||||||
snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name);
|
snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", name);
|
||||||
socket_unix.sun_path[0] = '\0';
|
socket_unix.sun_path[0] = '\0';
|
||||||
socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name);
|
socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, name);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "Your system does not support abstract sockets!\n");
|
||||||
|
goto error;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
|
strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
|
||||||
socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
|
socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path));
|
|
||||||
socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (connect(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) goto error;
|
if (connect(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) goto error;
|
||||||
svr->path = strdup(buf);
|
svr->path = strdup(buf);
|
||||||
|
|
|
@ -27,13 +27,9 @@ typedef enum _Ecore_Con_Type
|
||||||
{
|
{
|
||||||
ECORE_CON_LOCAL_USER,
|
ECORE_CON_LOCAL_USER,
|
||||||
ECORE_CON_LOCAL_SYSTEM,
|
ECORE_CON_LOCAL_SYSTEM,
|
||||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
|
||||||
ECORE_CON_LOCAL_ABSTRACT,
|
ECORE_CON_LOCAL_ABSTRACT,
|
||||||
#endif
|
ECORE_CON_REMOTE_SYSTEM,
|
||||||
ECORE_CON_REMOTE_SYSTEM
|
ECORE_CON_USE_SSL = 16
|
||||||
#if USE_OPENSSL
|
|
||||||
,ECORE_CON_USE_SSL = 16
|
|
||||||
#endif
|
|
||||||
} Ecore_Con_Type;
|
} Ecore_Con_Type;
|
||||||
|
|
||||||
struct _Ecore_Con_Client
|
struct _Ecore_Con_Client
|
||||||
|
|
|
@ -184,13 +184,11 @@ ecore_dbus_address_connect(Ecore_DBus_Address *addr, const void *data)
|
||||||
type = ECORE_CON_LOCAL_SYSTEM;
|
type = ECORE_CON_LOCAL_SYSTEM;
|
||||||
name = ecore_dbus_address_value_get(addr, "path");
|
name = ecore_dbus_address_value_get(addr, "path");
|
||||||
|
|
||||||
#ifdef HAVE_ABSTRACT_SOCKETS
|
|
||||||
if (!name)
|
if (!name)
|
||||||
{
|
{
|
||||||
name = ecore_dbus_address_value_get(addr, "abstract");
|
name = ecore_dbus_address_value_get(addr, "abstract");
|
||||||
type = ECORE_CON_LOCAL_ABSTRACT;
|
type = ECORE_CON_LOCAL_ABSTRACT;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!name) return NULL;
|
if (!name) return NULL;
|
||||||
port = -1;
|
port = -1;
|
||||||
|
|
Loading…
Reference in New Issue