+ write_byte(write_fd, 0);
+
+ close(write_fd);
+
+ /* Read the stdout from the pre-xfer exec program. This it is only
+ * displayed to the user if the script also returns an error status. */
+ for (bp = buf; msglen > 0 && (j = read(read_fd, bp, msglen)) > 0; msglen -= j) {
+ bp += j;
+ if (j > 1 && bp[-1] == '\n' && bp[-2] == '\r') {
+ bp--;
+ j--;
+ bp[-1] = '\n';
+ }
+ }
+ *bp = '\0';