w(1) uses strftime %b with to print the abbreviated month name

if a user logged in more than a week ago.
This may contain multibyte characters (e.g. when using UTF-8).
This string is then aligned on byte-length rathern than char-length,
resulting in misalignment and unfinished multibyte characters.

PR:             126657
Submitted by:   Johan van Selst <johans@stack.nl>
This commit is contained in:
Andrey A. Chernov 2008-08-20 12:32:19 +00:00
parent 040b1db930
commit e39ee4216c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181922

View File

@ -44,6 +44,7 @@ static const char sccsid[] = "@(#)pr_time.c 8.2 (Berkeley) 4/4/94";
#include <stdio.h>
#include <string.h>
#include <wchar.h>
#include "extern.h"
@ -82,7 +83,7 @@ pr_attime(time_t *started, time_t *now)
}
(void)strftime(buf, sizeof(buf), fmt, &tp);
(void)printf("%-7.7s", buf);
(void)wprintf(L"%-7.7s", buf);
}
/*