From: Johannes Sixt <j.sixt@viscovery.net>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 8/6] receive-pack: Send internal errors over side-band #2
Date: Wed, 10 Feb 2010 08:13:53 +0100 [thread overview]
Message-ID: <4B725CB1.1080908@viscovery.net> (raw)
In-Reply-To: <1265767290-25863-2-git-send-email-spearce@spearce.org>
Shawn O. Pearce schrieb:
> +static void rp_error(const char *err, ...) __attribute__((format (printf, 1, 2)));
> +static void rp_warning(const char *err, ...) __attribute__((format (printf, 1, 2)));
> +
> +static void report_message(const char *prefix, const char *err, va_list params)
> +{
> + int sz = strlen(prefix);
> + char msg[4096];
> +
> + strncpy(msg, prefix, sz);
> + sz += vsnprintf(msg + sz, sizeof(msg) - (sz + 1), err, params);
> + msg[sz++] = '\n';
This writes beyond the buffer if it is too small because the return value
tells how many characters *would* have been written if it were
sufficiently large, no?
> +
> + if (use_sideband)
> + send_sideband(1, 2, msg, sz, use_sideband);
> + else
> + xwrite(2, msg, sz);
> +}
> +
> +static void rp_warning(const char *err, ...)
> ...
> +static void rp_error(const char *err, ...)
> ...
Looks like we need set_report_routine().
Or did you replace only selected error() and warning() calls by rp_error()
and rp_warning()?
-- Hannes
next prev parent reply other threads:[~2010-02-10 7:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-10 2:01 [PATCH 7/6] t5401: Use a bare repository for the remote peer Shawn O. Pearce
2010-02-10 2:01 ` [PATCH 8/6] receive-pack: Send internal errors over side-band #2 Shawn O. Pearce
2010-02-10 7:13 ` Johannes Sixt [this message]
2010-02-10 7:23 ` Junio C Hamano
2010-02-10 8:13 ` Johannes Sixt
2010-02-10 17:34 ` [PATCH 8/6 v2] " Shawn O. Pearce
2010-02-11 8:34 ` Johannes Sixt
2010-02-11 15:05 ` Shawn O. Pearce
2010-02-11 19:04 ` Johannes Sixt
2010-02-10 17:17 ` [PATCH 8/6] " Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B725CB1.1080908@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.