diff options
author | Chiraag Nataraj <chiraag.nataraj@gmail.com> | 2017-07-30 14:22:36 -0400 |
---|---|---|
committer | Chiraag Nataraj <chiraag.nataraj@gmail.com> | 2017-07-30 14:22:36 -0400 |
commit | 74ca61fbd5c1c1ea7d96981c99064967f14e2233 (patch) | |
tree | 6161ac47fda2fe8c9510b0dd6864fe297ccd7fe6 /src | |
parent | Tentative implementation for #1405 (diff) | |
download | firejail-74ca61fbd5c1c1ea7d96981c99064967f14e2233.tar.gz firejail-74ca61fbd5c1c1ea7d96981c99064967f14e2233.tar.zst firejail-74ca61fbd5c1c1ea7d96981c99064967f14e2233.zip |
Remove debugging stuff, free start_child, exit properly
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/x11.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/firejail/x11.c b/src/firejail/x11.c index 01a40383d..d7b50e936 100644 --- a/src/firejail/x11.c +++ b/src/firejail/x11.c | |||
@@ -685,21 +685,13 @@ void x11_start_xpra(int argc, char **argv) { | |||
685 | char *start_child_prefix = "--start-child="; | 685 | char *start_child_prefix = "--start-child="; |
686 | char *start_child; | 686 | char *start_child; |
687 | start_child = malloc(total_length + strlen(start_child_prefix) + fpos + 2); | 687 | start_child = malloc(total_length + strlen(start_child_prefix) + fpos + 2); |
688 | printf("START_CHILD: %s\n", start_child); | ||
689 | printf("START_CHILD_PREFIX: %s\n", start_child_prefix); | ||
690 | strcpy(start_child,start_child_prefix); | 688 | strcpy(start_child,start_child_prefix); |
691 | printf("START_CHILD: %s\n", start_child); | ||
692 | for(i = 0; i < fpos; i++) { | 689 | for(i = 0; i < fpos; i++) { |
693 | printf("%s\n",firejail_argv[i]); | ||
694 | strncat(start_child,firejail_argv[i],strlen(firejail_argv[i])); | 690 | strncat(start_child,firejail_argv[i],strlen(firejail_argv[i])); |
695 | if(i != fpos - 1) | 691 | if(i != fpos - 1) |
696 | strncat(start_child," ",strlen(" ")); | 692 | strncat(start_child," ",strlen(" ")); |
697 | } | 693 | } |
698 | 694 | ||
699 | /* strncat(start_child,"\'",strlen("\'")); */ | ||
700 | |||
701 | printf("START_CHILD: %s\n", start_child); | ||
702 | |||
703 | server_argv[spos++] = start_child; | 695 | server_argv[spos++] = start_child; |
704 | 696 | ||
705 | server_argv[spos++] = NULL; | 697 | server_argv[spos++] = NULL; |
@@ -870,6 +862,15 @@ void x11_start_xpra(int argc, char **argv) { | |||
870 | 862 | ||
871 | /* sleep(1); // adding a delay in order to let the server start */ | 863 | /* sleep(1); // adding a delay in order to let the server start */ |
872 | 864 | ||
865 | // wait for server to end | ||
866 | while (1) { | ||
867 | pid_t pid = wait(NULL); | ||
868 | if (pid == server) { | ||
869 | free(start_child); | ||
870 | exit(0); | ||
871 | } | ||
872 | } | ||
873 | |||
873 | // wait for jail or server to end | 874 | // wait for jail or server to end |
874 | /* while (1) { */ | 875 | /* while (1) { */ |
875 | /* pid_t pid = wait(NULL); */ | 876 | /* pid_t pid = wait(NULL); */ |