+/* setup the fd used to propogate errors */
+void io_set_error_fd(int fd)
+{
+ io_error_fd = fd;
+}
+
+/* read some data from the error fd and write it to FERROR */
+static void read_error_fd(void)
+{
+ char buf[200];
+ int n;
+ int fd = io_error_fd;
+ io_error_fd = -1;
+
+ n = read(fd, buf, sizeof(buf)-1);
+ if (n > 0) {
+ rwrite(FERROR, buf, n);
+ }
+
+ io_error_fd = fd;
+}
+