Tidy up the end-of-data handling in backup
* Increase transfer buffer size to 32K
* Add logging about error conditions and fd teardown
* Pass the fd number as a command line option to the 'bu' subprocess
* Properly harvest the 'bu' subprocess after it's done
Change-Id: Id44dde25778ecf43c5604fd9d01d726ba58861e5
diff --git a/sockets.c b/sockets.c
index 7219293..80152f2 100644
--- a/sockets.c
+++ b/sockets.c
@@ -288,6 +288,7 @@
if(errno == EAGAIN) return;
if(errno == EINTR) continue;
}
+ D(" closing after write because r=%d and errno is %d\n", r, errno);
s->close(s);
return;
}
@@ -303,6 +304,7 @@
** we can now destroy it.
*/
if (s->closing) {
+ D(" closing because 'closing' is set after write\n");
s->close(s);
return;
}
@@ -372,6 +374,7 @@
}
/* Don't allow a forced eof if data is still there */
if((s->fde.force_eof && !r) || is_eof) {
+ D(" closing because is_eof=%d r=%d s->fde.force_eof=%d\n", is_eof, r, s->fde.force_eof);
s->close(s);
}
}