From 8073a5137f223bb481606b15edaa5ecb93ceffcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 17 Aug 2025 19:07:45 +0200 Subject: [PATCH] getmntpoint: Don't compare st_rdev for non-devices If the mntfromname of a mountpoint is not a device (e.g. nullfs, tarfs, procfs) we shouldn't compare st_rdev, as any match will be spurious. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51945 --- lib/libutil/mntopts.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libutil/mntopts.c b/lib/libutil/mntopts.c index 1d9347e3108..07d3dd6d98a 100644 --- a/lib/libutil/mntopts.c +++ b/lib/libutil/mntopts.c @@ -185,6 +185,7 @@ getmntpoint(const char *name) strncpy(statfsp->f_mntfromname, device, len); } if (stat(ddevname, &mntdevstat) == 0 && + S_ISCHR(mntdevstat.st_mode) && mntdevstat.st_rdev == devstat.st_rdev) return (statfsp); }