git: 75aa61400cba - stable/13 - stat(1): Do not pass S_IFBLK to devname unconditionally
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 03 Feb 2023 00:27:03 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=75aa61400cba6a67ff0ad392d8a5cc2d3855bd3b commit 75aa61400cba6a67ff0ad392d8a5cc2d3855bd3b Author: Alexander Naumochkin <alexander.naumochkin@gmail.com> AuthorDate: 2023-01-28 13:31:39 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-02-03 00:26:12 +0000 stat(1): Do not pass S_IFBLK to devname unconditionally PR: 269190 (cherry picked from commit 050e4bca94e907c046e9ed63f90b5dd0e49fb405) --- usr.bin/stat/stat.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/usr.bin/stat/stat.c b/usr.bin/stat/stat.c index 8229e742da87..0033ff2258a6 100644 --- a/usr.bin/stat/stat.c +++ b/usr.bin/stat/stat.c @@ -640,14 +640,9 @@ format1(const struct stat *st, small = (sizeof(st->st_dev) == 4); data = (what == SHOW_st_dev) ? st->st_dev : st->st_rdev; #if HAVE_DEVNAME - sdata = (what == SHOW_st_dev) ? - devname(st->st_dev, S_IFBLK) : - devname(st->st_rdev, - S_ISCHR(st->st_mode) ? S_IFCHR : - S_ISBLK(st->st_mode) ? S_IFBLK : - 0U); - if (sdata == NULL) - sdata = "???"; + sdata = devname(what == SHOW_st_dev ? st->st_dev : + st->st_rdev, S_ISCHR(st->st_mode) ? S_IFCHR : + (S_ISBLK(st->st_mode) ? S_IFBLK : 0)); #endif /* HAVE_DEVNAME */ if (hilo == HIGH_PIECE) { data = major(data);