From 71ef524dec22e6ad42351d1d73fd4f9e9302aff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Mon, 11 Nov 2019 13:27:30 +0100 Subject: [PATCH] vm-file-editor: drop old wait-for-session mechanism --- qubes-rpc/vm-file-editor.c | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/qubes-rpc/vm-file-editor.c b/qubes-rpc/vm-file-editor.c index 45004e8..0373e90 100644 --- a/qubes-rpc/vm-file-editor.c +++ b/qubes-rpc/vm-file-editor.c @@ -147,11 +147,10 @@ void send_file_back(const char * filename) int main() { - struct stat stat_pre, stat_post, session_stat; + struct stat stat_pre, stat_post; int view_only = 0; char *filename = get_filename(&view_only); int child, status, log_fd, null_fd; - FILE *waiter_pidfile; copy_file_by_name(filename); if (view_only) { @@ -162,37 +161,7 @@ main() perror("stat pre"); exit(1); } -#ifdef DEBUG - fprintf(stderr, "time=%s, waiting for qubes-session\n", gettime()); -#endif - // wait for X server to starts (especially in DispVM) - if (stat("/tmp/qubes-session-env", &session_stat)) { - switch (child = fork()) { - case -1: - perror("fork"); - exit(1); - case 0: - waiter_pidfile = fopen("/tmp/qubes-session-waiter", "a"); - if (waiter_pidfile == NULL) { - perror("fopen waiter_pidfile"); - exit(1); - } - fprintf(waiter_pidfile, "%d\n", getpid()); - fclose(waiter_pidfile); - // check the second time, to prevent race - if (stat("/tmp/qubes-session-env", &session_stat)) { - // wait for qubes-session notify - pause(); - } - exit(0); - default: - waitpid(child, &status, 0); - if (WIFEXITED(status) && WEXITSTATUS(status) != 0) { - //propagate exit code from child - exit(WEXITSTATUS(status)); - } - } - } + #ifdef DEBUG fprintf(stderr, "time=%s, starting editor\n", gettime()); #endif