← Commit list

8eb0549e5

Bernhard Reutner-Fischer
Bernhard Reutner-Fischer
2007-01-17
FAILED Duration: 5s

Subject

- reuse return code of vsnprintf to avoid pulling in strlen

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

coreutils/stty.c+3 -3
@@ -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++;