usage: add set_warn_routine()
[gitweb.git] / sideband.c
index c0b6dcf703ee81b468d675c193e9b55e9b85f1ae..1e4d684d6c5dcdeee94f6eb64cfa6e2f17d44674 100644 (file)
@@ -108,9 +108,8 @@ int recv_sideband(const char *me, int in_stream, int out)
  * fd is connected to the remote side; send the sideband data
  * over multiplexed packet stream.
  */
-ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
+void send_sideband(int fd, int band, const char *data, ssize_t sz, int packet_max)
 {
-       ssize_t ssz = sz;
        const char *p = data;
 
        while (sz) {
@@ -121,16 +120,15 @@ ssize_t send_sideband(int fd, int band, const char *data, ssize_t sz, int packet
                if (packet_max - 5 < n)
                        n = packet_max - 5;
                if (0 <= band) {
-                       sprintf(hdr, "%04x", n + 5);
+                       xsnprintf(hdr, sizeof(hdr), "%04x", n + 5);
                        hdr[4] = band;
                        write_or_die(fd, hdr, 5);
                } else {
-                       sprintf(hdr, "%04x", n + 4);
+                       xsnprintf(hdr, sizeof(hdr), "%04x", n + 4);
                        write_or_die(fd, hdr, 4);
                }
                write_or_die(fd, p, n);
                p += n;
                sz -= n;
        }
-       return ssz;
 }