]> git.ipfire.org Git - thirdparty/git.git/blobdiff - daemon.c
Merge branch 'ep/maint-equals-null-cocci' for maint-2.35
[thirdparty/git.git] / daemon.c
index 842c36c64438bf013e6b01cd3955502165a2064e..aeda6966f05e928f453ee231a8d2f41da37ff0a6 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -232,13 +232,13 @@ static const char *path_ok(const char *directory, struct hostinfo *hi)
 
                rlen = strlcpy(interp_path, expanded_path.buf,
                               sizeof(interp_path));
+               strbuf_release(&expanded_path);
                if (rlen >= sizeof(interp_path)) {
                        logerror("interpolated path too large: %s",
                                 interp_path);
                        return NULL;
                }
 
-               strbuf_release(&expanded_path);
                loginfo("Interpolated dir '%s'", interp_path);
 
                dir = interp_path;
@@ -326,22 +326,18 @@ static int run_access_hook(struct daemon_service *service, const char *dir,
 {
        struct child_process child = CHILD_PROCESS_INIT;
        struct strbuf buf = STRBUF_INIT;
-       const char *argv[8];
-       const char **arg = argv;
        char *eol;
        int seen_errors = 0;
 
-       *arg++ = access_hook;
-       *arg++ = service->name;
-       *arg++ = path;
-       *arg++ = hi->hostname.buf;
-       *arg++ = get_canon_hostname(hi);
-       *arg++ = get_ip_address(hi);
-       *arg++ = hi->tcp_port.buf;
-       *arg = NULL;
+       strvec_push(&child.args, access_hook);
+       strvec_push(&child.args, service->name);
+       strvec_push(&child.args, path);
+       strvec_push(&child.args, hi->hostname.buf);
+       strvec_push(&child.args, get_canon_hostname(hi));
+       strvec_push(&child.args, get_ip_address(hi));
+       strvec_push(&child.args, hi->tcp_port.buf);
 
        child.use_shell = 1;
-       child.argv = argv;
        child.no_stdin = 1;
        child.no_stderr = 1;
        child.out = -1;
@@ -922,7 +918,7 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
 #endif
        }
 
-       cld.argv = cld_argv.v;
+       strvec_pushv(&cld.args, cld_argv.v);
        cld.in = incoming;
        cld.out = dup(incoming);