Merge remote-tracking branch 'origin/pr/63'

* origin/pr/63:
  qrexec: hide timing debug messages in vm-file-editor
  qrexec: write service stderr to both syslog and caller
This commit is contained in:
Marek Marczykowski-Górecki 2016-03-14 16:11:18 +01:00
commit 574210c353
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 18 additions and 4 deletions

View File

@ -1,9 +1,18 @@
#!/bin/sh #!/bin/sh
mkfifo /tmp/qrexec-rpc-stderr.$$ # write stderr to both calling party and local log; be very careful about
logger -t "$1-$2" -f /tmp/qrexec-rpc-stderr.$$ >/dev/null 2>&1 </dev/null & # closing file descriptors here - if either stdout or stderr will not be closed
exec 2>/tmp/qrexec-rpc-stderr.$$ # when service process does the same - service call will hang (waiting for EOF
rm -f /tmp/qrexec-rpc-stderr.$$ # on stdout/stderr)
stderr_pipe=/tmp/qrexec-rpc-stderr.$$
mkfifo $stderr_pipe
# tee can't write to file descriptor, nor /proc/self/fd/2 (EXIO on open)
return_stderr_pipe=/tmp/qrexec-rpc-stderr-return.$$
mkfifo $return_stderr_pipe
{ cat <$return_stderr_pipe >&2 2>/dev/null; rm -f $return_stderr_pipe; } &
{ tee $return_stderr_pipe 2>/dev/null <$stderr_pipe |\
logger -t "$1-$2" >/dev/null 2>&1; rm -f $stderr_pipe; } &
exec 2>$stderr_pipe
QUBES_RPC=/etc/qubes-rpc QUBES_RPC=/etc/qubes-rpc
LOCAL_QUBES_RPC=/usr/local/etc/qubes-rpc LOCAL_QUBES_RPC=/usr/local/etc/qubes-rpc

View File

@ -12,6 +12,7 @@
#define USER_HOME "/home/user" #define USER_HOME "/home/user"
#define TMP_LOC "/tmp/qopen/" #define TMP_LOC "/tmp/qopen/"
// #define DEBUG
static const char *cleanup_filename = NULL; static const char *cleanup_filename = NULL;
@ -154,7 +155,9 @@ main()
perror("stat pre"); perror("stat pre");
exit(1); exit(1);
} }
#ifdef DEBUG
fprintf(stderr, "time=%s, waiting for qubes-session\n", gettime()); fprintf(stderr, "time=%s, waiting for qubes-session\n", gettime());
#endif
// wait for X server to starts (especially in DispVM) // wait for X server to starts (especially in DispVM)
if (stat("/tmp/qubes-session-env", &session_stat)) { if (stat("/tmp/qubes-session-env", &session_stat)) {
switch (child = fork()) { switch (child = fork()) {
@ -183,7 +186,9 @@ main()
} }
} }
} }
#ifdef DEBUG
fprintf(stderr, "time=%s, starting editor\n", gettime()); fprintf(stderr, "time=%s, starting editor\n", gettime());
#endif
switch (child = fork()) { switch (child = fork()) {
case -1: case -1:
perror("fork"); perror("fork");