aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-29 21:16:34 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-29 21:16:34 +0800
commit9c4389776a8f766932bb9b2cf4f7f3ec7de3de2b (patch)
treeafa2a972dfd2dd6b81e69b2f5b889262cad9bd2a
parentAttempt to make hookc.c portable (diff)
downloadforge-9c4389776a8f766932bb9b2cf4f7f3ec7de3de2b.tar.gz
forge-9c4389776a8f766932bb9b2cf4f7f3ec7de3de2b.tar.zst
forge-9c4389776a8f766932bb9b2cf4f7f3ec7de3de2b.zip
hookc: Fix variable placement
-rw-r--r--hookc/hookc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hookc/hookc.c b/hookc/hookc.c
index 14acc01..83b3a5e 100644
--- a/hookc/hookc.c
+++ b/hookc/hookc.c
@@ -200,8 +200,8 @@ int main(int argc, char *argv[]) {
/*
* Splice stdin to the daemon. For pre-receive it's just old/new/ref.
*/
- ssize_t stdin_bytes_spliced;
#if USE_SPLICE
+ ssize_t stdin_bytes_spliced;
while ((stdin_bytes_spliced = splice(STDIN_FILENO, NULL, sock, NULL, stdin_pipe_size, SPLICE_F_MORE)) > 0) {
}
if (stdin_bytes_spliced == -1) {
@@ -272,8 +272,8 @@ int main(int argc, char *argv[]) {
* We usually don't actually use this as the daemon could easily write
* to the SSH connection's stderr directly anyway.
*/
- ssize_t stderr_bytes_spliced;
#if USE_SPLICE
+ ssize_t stderr_bytes_spliced;
while ((stderr_bytes_spliced = splice(sock, NULL, STDERR_FILENO, NULL, stderr_pipe_size, SPLICE_F_MORE)) > 0) {
}
if (stderr_bytes_spliced == -1 && errno != ECONNRESET) {