From 821d853abb36e92ab130253dfcf763db7f07c585 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Thu, 12 Jul 2012 03:45:20 +0200 Subject: [PATCH] vm/file-editor: load session environment (#620) Especially set DBUS socket to allow interprocess communication instead of spawning new instances or timeouts. --- qubes_rpc/vm-file-editor.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qubes_rpc/vm-file-editor.c b/qubes_rpc/vm-file-editor.c index 3017286..96c3bd4 100644 --- a/qubes_rpc/vm-file-editor.c +++ b/qubes_rpc/vm-file-editor.c @@ -58,6 +58,8 @@ main() struct stat stat_pre, stat_post, session_stat; char *filename = get_filename(); int child, status, log_fd; + char var[1024], val[4096]; + FILE *env_file; FILE *waiter_pidfile; copy_file(filename); @@ -99,6 +101,13 @@ main() exit(1); case 0: close(0); + + env_file = fopen("/tmp/qubes-session-env", "r"); + while(fscanf(env_file, "%1024[^=]=%4096[^\n]\n", var, val) == 2) { + setenv(var, val, 1); + } + fclose(env_file); + log_fd = open("/tmp/mimeopen.log", O_CREAT | O_APPEND, 0666); if (log_fd == -1) { perror("open /tmp/mimeopen.log");