mirror of
https://github.com/opnsense/src.git
synced 2026-07-09 09:12:54 -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.
(cherry picked from commit 20f8331aca)
This commit is contained in:
parent
6f9036a651
commit
98d3422e5e
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