forked from enlightenment/enlightenment
e start - clean up xdg runtime dir in e_start not e if created in estart
This commit is contained in:
parent
a4acb240cb
commit
71cbbeff27
|
@ -1159,12 +1159,6 @@ _e_main_shutdown(int errcode)
|
||||||
if (_idle_after) ecore_idle_enterer_del(_idle_after);
|
if (_idle_after) ecore_idle_enterer_del(_idle_after);
|
||||||
_idle_after = NULL;
|
_idle_after = NULL;
|
||||||
|
|
||||||
dir = getenv("XDG_RUNTIME_DIR");
|
|
||||||
if (dir)
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "%s/.e-deleteme", dir);
|
|
||||||
if (ecore_file_exists(buf)) ecore_file_recursive_rm(dir);
|
|
||||||
}
|
|
||||||
for (i = (_e_main_lvl - 1); i >= 0; i--)
|
for (i = (_e_main_lvl - 1); i >= 0; i--)
|
||||||
(*_e_main_shutdown_func[i])();
|
(*_e_main_shutdown_func[i])();
|
||||||
if (errcode < 0) exit(errcode);
|
if (errcode < 0) exit(errcode);
|
||||||
|
|
|
@ -549,6 +549,25 @@ done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
rmrf(const char *path)
|
||||||
|
{
|
||||||
|
Eina_Iterator *iter = eina_file_direct_ls(path);
|
||||||
|
|
||||||
|
if (iter)
|
||||||
|
{
|
||||||
|
Eina_File_Direct_Info *info;
|
||||||
|
|
||||||
|
EINA_ITERATOR_FOREACH(iter, info)
|
||||||
|
{
|
||||||
|
if (info->type == EINA_FILE_DIR) rmrf(info->path);
|
||||||
|
else eina_file_unlink(info->path);
|
||||||
|
}
|
||||||
|
eina_iterator_free(iter);
|
||||||
|
}
|
||||||
|
eina_file_unlink(path);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -562,6 +581,7 @@ main(int argc, char **argv)
|
||||||
Eina_Bool really_know = EINA_FALSE;
|
Eina_Bool really_know = EINA_FALSE;
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
int ret = -1;
|
||||||
pid_t child = -1;
|
pid_t child = -1;
|
||||||
Eina_Bool restart = EINA_TRUE;
|
Eina_Bool restart = EINA_TRUE;
|
||||||
|
|
||||||
|
@ -745,9 +765,15 @@ main(int argc, char **argv)
|
||||||
child = fork();
|
child = fork();
|
||||||
|
|
||||||
if (child < 0)
|
if (child < 0)
|
||||||
return -1;
|
{
|
||||||
|
ret = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
else if (child == 0)
|
else if (child == 0)
|
||||||
return _e_start_child(args, really_know);
|
{ // we are in the child fork - so exec
|
||||||
|
ret = _e_start_child(args, really_know);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
putenv("E_RESTART_OK=");
|
putenv("E_RESTART_OK=");
|
||||||
/* in the parent - ptrace attach and continue */
|
/* in the parent - ptrace attach and continue */
|
||||||
|
@ -758,8 +784,7 @@ main(int argc, char **argv)
|
||||||
not_done:
|
not_done:
|
||||||
result = waitpid(child, &status, WNOHANG);
|
result = waitpid(child, &status, WNOHANG);
|
||||||
/* Wait for E */
|
/* Wait for E */
|
||||||
if (!result)
|
if (!result) result = waitpid(-1, &status, 0);
|
||||||
result = waitpid(-1, &status, 0);
|
|
||||||
|
|
||||||
if (result == child)
|
if (result == child)
|
||||||
{
|
{
|
||||||
|
@ -801,12 +826,8 @@ not_done:
|
||||||
remember_sigusr1);
|
remember_sigusr1);
|
||||||
free(backtrace_str);
|
free(backtrace_str);
|
||||||
|
|
||||||
if (getenv("DISPLAY"))
|
if (getenv("DISPLAY")) kill(child, SIGKILL);
|
||||||
{
|
if (WEXITSTATUS(r) == 1) restart = EINA_FALSE;
|
||||||
kill(child, SIGKILL);
|
|
||||||
}
|
|
||||||
if (WEXITSTATUS(r) == 1)
|
|
||||||
restart = EINA_FALSE;
|
|
||||||
}
|
}
|
||||||
else if (WEXITSTATUS(status) == 111)
|
else if (WEXITSTATUS(status) == 111)
|
||||||
{
|
{
|
||||||
|
@ -831,10 +852,15 @@ not_done:
|
||||||
_e_ptrace_detach(child, 0, really_know);
|
_e_ptrace_detach(child, 0, really_know);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!done)
|
if (!done) goto not_done;
|
||||||
goto not_done;
|
|
||||||
}
|
}
|
||||||
|
// clean up xdg runtime_dir if we created it
|
||||||
return -1;
|
s = getenv("XDG_RUNTIME_DIR");
|
||||||
|
if ((s) && (stat(s, &st) == 0) && (S_ISDIR(st.st_mode)))
|
||||||
|
{
|
||||||
|
snprintf(buf, sizeof(buf), "%s/.e-deleteme", s);
|
||||||
|
if (stat(buf, &st) == 0) rmrf(s);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue