From: Bernhard Reutner-Fischer Date: Wed, 17 Jan 2007 19:46:33 +0000 (-0000) Subject: - reuse return code of vsnprintf to avoid pulling in strlen X-Git-Tag: 1_4_0~21 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8eb0549e5dedcc379839e91cec70ddbee0dc8130;p=oweals%2Fbusybox.git - reuse return code of vsnprintf to avoid pulling in strlen --- diff --git a/coreutils/stty.c b/coreutils/stty.c index 2682e969d..69dee30b3 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c @@ -463,10 +463,10 @@ static void wrapf(const char *message, ...) int buflen; va_start(args, message); - vsnprintf(buf, sizeof(buf), message, args); + buflen = vsnprintf(buf, sizeof(buf), message, args); va_end(args); - buflen = strlen(buf); - if (!buflen) return; + /* buflen = strlen(buf); cheaper not to pull in strlen */ + if (!buflen /*|| buflen >= sizeof(buf)*/) return; if (current_col > 0) { current_col++;