git: 050e4bca94e9 - main - stat(1): Do not pass S_IFBLK to devname unconditionally
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 28 Jan 2023 18:05:11 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=050e4bca94e907c046e9ed63f90b5dd0e49fb405 commit 050e4bca94e907c046e9ed63f90b5dd0e49fb405 Author: Alexander Naumochkin <alexander.naumochkin@gmail.com> AuthorDate: 2023-01-28 13:31:39 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-01-28 18:04:43 +0000 stat(1): Do not pass S_IFBLK to devname unconditionally PR: 269190 Reviewed by: kib MFC after: 1 week --- 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 9d94399a6333..dca7363f4fcc 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);