eina_debug: switch to vpath

Summary:
eina debug was using the xdg runtime dir in a wrong manner. Since the
directory should be only used by the user, and the directory should be
be subject of any other usage. Additionally, apps tend to create files
like: $XDG_RUNTIME_DIR/foo.bar which is probebly not what you want in
$HOME.

ref T7107

Depends on D6747

Reviewers: zmike, stefan_schmidt, #committers

Reviewed By: zmike, #committers

Subscribers: #reviewers, cedric, #committers, zmike

Tags: #efl

Maniphest Tasks: T7107

Differential Revision: https://phab.enlightenment.org/D6748
This commit is contained in:
Marcel Hollerbach 2018-08-20 12:59:15 -04:00 committed by Mike Blumenkrantz
parent 7a02c2ac38
commit cf74462b76
2 changed files with 5 additions and 13 deletions

View File

@ -70,6 +70,8 @@
#include "eina_hash.h"
#include "eina_stringshare.h"
#include "eina_debug_private.h"
#include "eina_vpath.h"
#include "eina_internal.h"
#ifdef EINA_HAVE_PTHREAD_SETNAME
# ifndef __linux__
@ -442,16 +444,6 @@ _opcodes_unregister_all(Eina_Debug_Session *session)
}
}
static const char *
_socket_home_get()
{
// get possible debug daemon socket directory base
const char *dir = getenv("XDG_RUNTIME_DIR");
if (!dir) dir = eina_environment_home_get();
if (!dir) dir = eina_environment_tmp_get();
return dir;
}
#define LENGTH_OF_SOCKADDR_UN(s) \
(strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
#endif
@ -514,7 +506,7 @@ eina_debug_local_connect(Eina_Bool is_master)
// ~/.ecore/efl_debug/0
// or maybe
// /var/run/UID/.ecore/efl_debug/0
snprintf(buf, sizeof(buf), "%s/%s/%s/%i", _socket_home_get(),
eina_vpath_resolve_snprintf(buf, sizeof(buf), "(:usr.run:)/%s/%s/%i",
LOCAL_SERVER_PATH, LOCAL_SERVER_NAME, LOCAL_SERVER_PORT);
// create the socket
fd = socket(AF_UNIX, SOCK_STREAM, 0);

View File

@ -173,9 +173,10 @@ static const struct eina_desc_setup _eina_desc_setup[] = {
S(module),
S(mempool),
S(list),
S(stringshare),
S(vpath),
S(debug),
S(evlog),
S(stringshare),
S(error),
S(safety_checks),
S(magic_string),
@ -205,7 +206,6 @@ static const struct eina_desc_setup _eina_desc_setup[] = {
S(safepointer),
S(slstr),
S(promise),
S(vpath),
#undef S
};
static const size_t _eina_desc_setup_len = sizeof(_eina_desc_setup) /