Don't set LADISH env vars for L0 & L1

Having these variables set enables apps to discrimination
against ladish, by error or otherwise. In particular
neither LADISH L0 nor L1 imply that user should face mayhem
of standard file menu items for either new, open, save
and/or saveas being disabled.
This commit is contained in:
Nedko Arnaudov 2023-06-05 14:12:11 +03:00
parent 25ab42cabe
commit c93f0d8458
3 changed files with 17 additions and 7 deletions

View File

@ -975,11 +975,14 @@ bool ladish_app_supervisor_start_app(ladish_app_supervisor_handle supervisor_han
char uuid_str[37];
char * js_dir;
bool ret;
bool set_env_vars;
app_ptr->zombie = false;
ASSERT(app_ptr->pid == 0);
set_env_vars = ladish_level_string_to_integer(app_ptr->level) >= 2;
if (strcmp(app_ptr->level, LADISH_APP_LEVEL_JACKSESSION) == 0)
{
uuid_unparse(app_ptr->uuid, uuid_str);
@ -1003,6 +1006,7 @@ bool ladish_app_supervisor_start_app(ladish_app_supervisor_handle supervisor_han
js_dir,
app_ptr->terminal,
app_ptr->commandline,
set_env_vars,
&app_ptr->pid);
free(js_dir);

View File

@ -271,7 +271,8 @@ loader_exec_program(
bool run_in_terminal,
const char * vgraph_name,
const char * project_name,
const char * app_name)
const char * app_name,
bool set_env_vars)
{
const char * argv[8];
unsigned int i;
@ -293,12 +294,15 @@ loader_exec_program(
fprintf(stderr, "Could not change directory to working dir '%s' for app '%s': %s\n", working_dir, app_name, strerror(errno));
}
setenv("LADISH_APP_NAME", app_name, true);
setenv("LADISH_VGRAPH_NAME", vgraph_name, true);
if (project_name != NULL)
if (set_env_vars)
{
setenv("LADISH_PROJECT_NAME", project_name, true);
setenv("LADISH_APP_NAME", app_name, true);
setenv("LADISH_VGRAPH_NAME", vgraph_name, true);
if (project_name != NULL)
{
setenv("LADISH_PROJECT_NAME", project_name, true);
}
}
if (session_dir != NULL)
@ -531,6 +535,7 @@ loader_execute(
const char * session_dir,
bool run_in_terminal,
const char * commandline,
bool set_env_vars,
pid_t * pid_ptr)
{
pid_t pid;
@ -642,7 +647,7 @@ loader_execute(
set_ldpreload();
loader_exec_program(commandline, working_dir, session_dir, run_in_terminal, vgraph_name, project_name, app_name);
loader_exec_program(commandline, working_dir, session_dir, run_in_terminal, vgraph_name, project_name, app_name, set_env_vars);
return false; /* We should never get here */
}

View File

@ -38,6 +38,7 @@ loader_execute(
const char * session_dir,
bool run_in_terminal,
const char * commandline,
bool set_env_vars,
pid_t * pid_ptr);
void loader_run(void);