aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.txt3
-rw-r--r--pseudo_client.c13
2 files changed, 16 insertions, 0 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 8a817b5..844e177 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -5,6 +5,9 @@
* (seebs) mask out group/other write bits in real filesystem to
reduce risks when assembling a rootfs including world-writeable
directories.
+ * (seebs) send a round-trip message to the server before exiting
+ if any messages have been sent, so the program won't exit before
+ the server processed those messages.
2014-05-15:
* (seebs) drop flags when calling fchmodat() to appease GNU tar.
diff --git a/pseudo_client.c b/pseudo_client.c
index 7330f9d..39f9641 100644
--- a/pseudo_client.c
+++ b/pseudo_client.c
@@ -76,6 +76,9 @@ static int nfds = 0;
static int messages = 0;
static struct timeval message_time = { .tv_sec = 0 };
static int pseudo_inited = 0;
+
+static int sent_messages = 0;
+
int pseudo_nosymlinkexp = 0;
/* note: these are int, not uid_t/gid_t, so I can use 'em with scanf */
@@ -731,6 +734,11 @@ client_ping(void) {
return 0;
}
+static void
+void_client_ping(void) {
+ client_ping();
+}
+
int
pseudo_fd(int fd, int how) {
int newfd;
@@ -1066,6 +1074,11 @@ pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char *path
/* disable wrappers */
pseudo_antimagic();
+ if (!sent_messages) {
+ sent_messages = 1;
+ atexit(void_client_ping);
+ }
+
if (op == OP_RENAME) {
va_list ap;
if (!path) {