mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
usr.bin/stat: honour locale for "-t %+"
The man page states that "-t %+" prints time information in the same format as date with no format specifier. This was not the case, the format used was always that of date for the POSIX locale. The fix suggested by the reporter leads to output that matches the documentation. Reported by: Jamie Landeg-Jones <jamie@catflap.org> MFC after: 3 days
This commit is contained in:
parent
dc6dd769de
commit
20f8331aca
1 changed files with 2 additions and 0 deletions
|
|
@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
|
|||
#include <errno.h>
|
||||
#include <grp.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <paths.h>
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -763,6 +764,7 @@ format1(const struct stat *st,
|
|||
ts.tv_sec = 0;
|
||||
tm = localtime(&ts.tv_sec);
|
||||
}
|
||||
(void)setlocale(LC_TIME, "");
|
||||
(void)strftime(path, sizeof(path), timefmt, tm);
|
||||
sdata = path;
|
||||
formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
|
||||
|
|
|
|||
Loading…
Reference in a new issue