Code

upload-pack: ignore write errors to stderr
[git.git] / upload-pack.c
index 7b86f6965b5306f2162a9076f6ab3bbc1cc32a4b..94aa0dab4866f86f197dc84956db5e19601a603a 100644 (file)
@@ -1,3 +1,6 @@
+#include <signal.h>
+#include <sys/wait.h>
+#include <sys/poll.h>
 #include "cache.h"
 #include "refs.h"
 #include "pkt-line.h"
@@ -5,9 +8,6 @@
 #include "object.h"
 #include "commit.h"
 #include "exec_cmd.h"
-#include <signal.h>
-#include <sys/poll.h>
-#include <sys/wait.h>
 
 static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=nn] <dir>";
 
@@ -51,6 +51,10 @@ static ssize_t send_client_data(int fd, const char *data, ssize_t sz)
                if (fd == 3)
                        /* emergency quit */
                        fd = 2;
+               if (fd == 2) {
+                       xwrite(fd, data, sz);
+                       return sz;
+               }
                return safe_write(fd, data, sz);
        }
        p = data;
@@ -95,8 +99,8 @@ static void create_pack_file(void)
                int i;
                int args;
                const char **argv;
+               const char **p;
                char *buf;
-               char **p;
 
                if (create_full_pack) {
                        args = 10;
@@ -441,7 +445,7 @@ static int receive_needs(void)
 
 static int send_ref(const char *refname, const unsigned char *sha1)
 {
-       static char *capabilities = "multi_ack thin-pack side-band";
+       static const char *capabilities = "multi_ack thin-pack side-band";
        struct object *o = parse_object(sha1);
 
        if (!o)