aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README1
-rw-r--r--src/firejail/util.c25
2 files changed, 24 insertions, 2 deletions
diff --git a/README b/README
index ab5577382..58690663b 100644
--- a/README
+++ b/README
@@ -125,6 +125,7 @@ Zack Weinberg (https://github.com/zackw)
125 - rework X11 xorg processing 125 - rework X11 xorg processing
126 - rework fcopy, --follow-link support in fcopy 126 - rework fcopy, --follow-link support in fcopy
127 - follow link support in --private-bin 127 - follow link support in --private-bin
128 - wait_for_other function rewrite
128Austin S. Hemmelgarn (https://github.com/Ferroin) 129Austin S. Hemmelgarn (https://github.com/Ferroin)
129 - unbound profile update 130 - unbound profile update
130Igor Bukanov (https://github.com/ibukanov) 131Igor Bukanov (https://github.com/ibukanov)
diff --git a/src/firejail/util.c b/src/firejail/util.c
index fbb0a1e87..9b9308670 100644
--- a/src/firejail/util.c
+++ b/src/firejail/util.c
@@ -605,16 +605,37 @@ void wait_for_other(int fd) {
605 *ptr = '\0'; 605 *ptr = '\0';
606 } 606 }
607 else { 607 else {
608 fprintf(stderr, "Error: cannot establish communication with the parent, exiting...\n"); 608 fprintf(stderr, "Error: proc %d cannot sync with peer: %s\n",
609 getpid(), ferror(stream) ? strerror(errno) : "unexpected EOF");
610
611 int status = 0;
612 pid_t pid = wait(&status);
613 if (pid != -1) {
614 if (WIFEXITED(status))
615 fprintf(stderr, "Peer %d unexpectedly exited with status %d\n",
616 pid, WEXITSTATUS(status));
617 else if (WIFSIGNALED(status))
618 fprintf(stderr, "Peer %d unexpectedly killed (%s)\n",
619 pid, strsignal(WTERMSIG(status)));
620 else
621 fprintf(stderr, "Peer %d unexpectedly exited "
622 "(un-decodable wait status %04x)\n", pid, status);
623 }
609 exit(1); 624 exit(1);
610 } 625 }
626
611 if (strcmp(childstr, "arg_noroot=0") == 0) 627 if (strcmp(childstr, "arg_noroot=0") == 0)
612 arg_noroot = 0; 628 arg_noroot = 0;
629 else if (strcmp(childstr, "arg_noroot=1") == 0)
630 arg_noroot = 1;
631 else {
632 fprintf(stderr, "Error: unexpected message from peer: %s\n", childstr);
633 exit(1);
634 }
613 635
614 fclose(stream); 636 fclose(stream);
615} 637}
616 638
617
618void notify_other(int fd) { 639void notify_other(int fd) {
619 FILE* stream; 640 FILE* stream;
620 int newfd = dup(fd); 641 int newfd = dup(fd);