Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jan 2023 13:38:05 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 269190] bugs in stat(1) and devname(3), wrong report on disk names
Message-ID:  <bug-269190-227-O8m8MllKx6@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-269190-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-269190-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D269190

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 =3D (what =3D=3D SHOW_st_dev) ?
-        devname(st->st_dev, S_IFBLK) :
-        devname(st->st_rdev,=20
-        S_ISCHR(st->st_mode) ? S_IFCHR :
-        S_ISBLK(st->st_mode) ? S_IFBLK :
-        0U);
-    if (sdata =3D=3D NULL)
-       sdata =3D "???";
+     sdata =3D devname(what =3D=3D 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 */

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-269190-227-O8m8MllKx6>