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
This commit is contained in:
Dag-Erling Smørgrav
2025-08-17 19:07:45 +02:00
parent d4b59682cb
commit 8073a5137f
+1
View File
@@ -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);
}