aboutsummaryrefslogtreecommitdiff
path: root/git_hooks_client
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-03 21:34:51 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-03 21:34:51 +0800
commitbd2ad340e61be08b3cfb615c94cbfb708617eb59 (patch)
tree5b614dfcf57e950866df1a264941399f17a19d41 /git_hooks_client
parentAdd SPDX license headers to all HTML templates (diff)
downloadforge-bd2ad340e61be08b3cfb615c94cbfb708617eb59.tar.gz
forge-bd2ad340e61be08b3cfb615c94cbfb708617eb59.tar.zst
forge-bd2ad340e61be08b3cfb615c94cbfb708617eb59.zip
hooks: Comment on how using the first byte as return doesn't make sense
Diffstat (limited to 'git_hooks_client')
-rw-r--r--git_hooks_client/git_hooks_client.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/git_hooks_client/git_hooks_client.c b/git_hooks_client/git_hooks_client.c
index 46fd02a..fc49d91 100644
--- a/git_hooks_client/git_hooks_client.c
+++ b/git_hooks_client/git_hooks_client.c
@@ -177,11 +177,17 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- /*
- * The first byte of the response from the UNIX domain socket is the
- * status code. We read it and record it as our return value.
- */
- char status_buf[1];
+ /*
+ * The first byte of the response from the UNIX domain socket is the
+ * status code. We read it and record it as our return value.
+ *
+ * FIXME: It doesn't make sense to require the return value to be
+ * sent before the log message. However, if we were to keep splicing,
+ * it's difficult to get the last byte before EOF. Perhaps we could
+ * hack together some sort of OOB message or ancillary data, or perhaps
+ * even use signals.
+ */
+ char status_buf[1];
ssize_t bytes_read = read(sock, status_buf, 1);
switch (bytes_read) {
case -1: