[Bug 269190] bugs in stat(1) and devname(3), wrong report on disk names
Date: Sat, 28 Jan 2023 13:38:05 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269190
Konstantin Belousov <kib@FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kib@FreeBSD.org
--- Comment #1 from Konstantin Belousov <kib@FreeBSD.org> ---
WRT the stat(1) patch, why do you _not_ pass S_IFBLK when the device is the
block device? IMO it is more correct to do the following:
#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 */
--
You are receiving this mail because:
You are the assignee for the bug.