From 042f2727bffadca7c449df3c0f2464d832aef959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Mon, 16 Dec 2019 12:26:24 +0100 Subject: [PATCH] * src/progress.c (count_cols): Fix return value if USE_NLS_PROGRESS_BAR is undefined Taking patch from #54126 Reported-by: Vyacheslav Copyright-paperwork-exempt: Yes --- src/progress.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/progress.c b/src/progress.c index 8eddedd3..80775b0c 100644 --- a/src/progress.c +++ b/src/progress.c @@ -861,10 +861,12 @@ cols_to_bytes (const char *mbs, const int cols, int *ncols) #else static int count_cols (const char *mbs) { return (int) strlen(mbs); } static int -cols_to_bytes (const char *mbs _GL_UNUSED, const int cols, int *ncols) +cols_to_bytes (const char *mbs, const int cols, int *ncols) { - *ncols = cols; - return cols; + int len = strlen(mbs); + int ret = len < cols ? len : cols; + *ncols = ret; + return ret; } #endif