grep.c: use error_errno()
[gitweb.git] / builtin / upload-archive.c
index 32ab94cd06b43cd05316f9a16981adc883c0d066..2caedf184959e2120d8e30a02f885925ceb412b4 100644 (file)
@@ -49,15 +49,14 @@ int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix)
 __attribute__((format (printf, 1, 2)))
 static void error_clnt(const char *fmt, ...)
 {
-       char buf[1024];
+       struct strbuf buf = STRBUF_INIT;
        va_list params;
-       int len;
 
        va_start(params, fmt);
-       len = vsprintf(buf, fmt, params);
+       strbuf_vaddf(&buf, fmt, params);
        va_end(params);
-       send_sideband(1, 3, buflen, LARGE_PACKET_MAX);
-       die("sent error to the client: %s", buf);
+       send_sideband(1, 3, buf.buf, buf.len, LARGE_PACKET_MAX);
+       die("sent error to the client: %s", buf.buf);
 }
 
 static ssize_t process_input(int child_fd, int band)
@@ -105,8 +104,7 @@ int cmd_upload_archive(int argc, const char **argv, const char *prefix)
                pfd[1].events = POLLIN;
                if (poll(pfd, 2, -1) < 0) {
                        if (errno != EINTR) {
-                               error("poll failed resuming: %s",
-                                     strerror(errno));
+                               error_errno("poll failed resuming");
                                sleep(1);
                        }
                        continue;