6094: Avoid SIGPIPE by consuming DATA section even when it's not needed.
authorTom Clegg <tom@curoverse.com>
Fri, 22 May 2015 19:39:00 +0000 (15:39 -0400)
committerTom Clegg <tom@curoverse.com>
Fri, 22 May 2015 19:39:00 +0000 (15:39 -0400)
sdk/cli/bin/crunch-job

index 6ae04812325994678dad9e29d736b5556731f4f4..ae9d1e2c1ef5322ea8a70e882960ebb07b73135c 100755 (executable)
@@ -1983,6 +1983,12 @@ open L, ">", "$destdir.lock" or die "$destdir.lock: $!";
 flock L, LOCK_EX;
 if (readlink ("$destdir.commit") eq $commit && -d $destdir) {
   # This version already installed -> nothing to do.
+
+  # We must consume our DATA section, though: otherwise the process
+  # feeding it to us will get SIGPIPE.
+  my $buf;
+  while (read(DATA, $buf, 65536)) { }
+
   exit(0);
 }