From bd2ad340e61be08b3cfb615c94cbfb708617eb59 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 03 Mar 2025 21:34:51 +0800 Subject: [PATCH] hooks: Comment on how using the first byte as return doesn't make sense --- git_hooks_client/git_hooks_client.c | 16 +++++++++++----- diff --git a/git_hooks_client/git_hooks_client.c b/git_hooks_client/git_hooks_client.c index 46fd02a4c639a2b9826a244ab6c2d7e62ed1219e..fc49d915c8f9db46a760b71659c45a7f3c7c88f4 100644 --- a/git_hooks_client/git_hooks_client.c +++ b/git_hooks_client/git_hooks_client.c @@ -177,11 +177,17 @@ close(sock); 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: -- 2.48.1