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_hash.h"
#include "eina_stringshare.h" #include "eina_stringshare.h"
#include "eina_debug_private.h" #include "eina_debug_private.h"
#include "eina_vpath.h"
#include "eina_internal.h"
#ifdef EINA_HAVE_PTHREAD_SETNAME #ifdef EINA_HAVE_PTHREAD_SETNAME
# ifndef __linux__ # 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) \ #define LENGTH_OF_SOCKADDR_UN(s) \
(strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path)) (strlen((s)->sun_path) + (size_t)(((struct sockaddr_un *)NULL)->sun_path))
#endif #endif
@ -514,7 +506,7 @@ eina_debug_local_connect(Eina_Bool is_master)
// ~/.ecore/efl_debug/0 // ~/.ecore/efl_debug/0
// or maybe // or maybe
// /var/run/UID/.ecore/efl_debug/0 // /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); LOCAL_SERVER_PATH, LOCAL_SERVER_NAME, LOCAL_SERVER_PORT);
// create the socket // create the socket
fd = socket(AF_UNIX, SOCK_STREAM, 0); 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(module),
S(mempool), S(mempool),
S(list), S(list),
S(stringshare),
S(vpath),
S(debug), S(debug),
S(evlog), S(evlog),
S(stringshare),
S(error), S(error),
S(safety_checks), S(safety_checks),
S(magic_string), S(magic_string),
@ -205,7 +206,6 @@ static const struct eina_desc_setup _eina_desc_setup[] = {
S(safepointer), S(safepointer),
S(slstr), S(slstr),
S(promise), S(promise),
S(vpath),
#undef S #undef S
}; };
static const size_t _eina_desc_setup_len = sizeof(_eina_desc_setup) / static const size_t _eina_desc_setup_len = sizeof(_eina_desc_setup) /