Browse Source

qfile-agent.c: exit on EPIPE after gui progress write

The qvm-{copy,move}-to-vm.{gnome,kde} cancel buttons didn't actually
cancel, because qfile-agent ignored EPIPE and - via qfile_pack_init() -
SIGPIPE. So it never noticed when the local PROGRESS_TYPE=gui reader had
shut down.
Rusty Bird 5 years ago
parent
commit
8da7c7af60
1 changed files with 6 additions and 5 deletions
  1. 6 5
      qubes-rpc/qfile-agent.c

+ 6 - 5
qubes-rpc/qfile-agent.c

@@ -33,15 +33,16 @@ void do_notify_progress(long long total, int flag)
         ignore = write(2, msg, strlen(msg));
         if (flag == PROGRESS_FLAG_DONE)
             ignore = write(2, "\n", 1);
+        if (ignore < 0) {
+            /* silence gcc warning */
+        }
     }
     if (!strcmp(progress_type_env, "gui") && saved_stdout_env) {
         char msg[256];
         snprintf(msg, sizeof(msg), "%lld\n", total);
-        ignore = write(strtoul(saved_stdout_env, NULL, 0), msg,
-                strlen(msg));
-    }
-    if (ignore < 0) {
-        /* silence gcc warning */
+        if (write(strtoul(saved_stdout_env, NULL, 0), msg, strlen(msg)) == -1
+            && errno == EPIPE)
+            exit(32);
     }
 }