git: 7d350f5fd5d8 - stable/15 - rc.d/tmp: Fix dupe mount check

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Tue, 07 Jul 2026 06:38:47 UTC
The branch stable/15 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=7d350f5fd5d8d0abfc177d00a0c8c78cdef99fb9

commit 7d350f5fd5d8d0abfc177d00a0c8c78cdef99fb9
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-26 14:39:03 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-07-07 06:38:11 +0000

    rc.d/tmp: Fix dupe mount check
    
    Before mounting a new mfs on /tmp, we check if there already is one.
    However, the dupe check only takes /dev/md[0-9]* into account, while the
    default mfs type these days is tmpfs.  Rewrite it to look for tmpfs as
    well.
    
    Note that the dupe check is redundant in the tmpmfs=auto case, but we
    leave moving it for later.
    
    PR:             182035
    MFC after:      1 week
    Reviewed by:    kevans, allanjude
    Differential Revision:  https://reviews.freebsd.org/D57682
    
    (cherry picked from commit 45efa4e61623e3eeee7fd0a3f4436616e24c8e98)
---
 libexec/rc/rc.d/tmp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libexec/rc/rc.d/tmp b/libexec/rc/rc.d/tmp
index cc970816e45c..76baaa672c6a 100755
--- a/libexec/rc/rc.d/tmp
+++ b/libexec/rc/rc.d/tmp
@@ -42,10 +42,15 @@ tmp_svcj="NO"
 
 mount_tmpmfs()
 {
-	while read line; do
-		case $line in
-		/dev/md[0-9]*\ /tmp)
-			return;;
+	while read _dev _ _ _ _ _mp; do
+		case ${_mp} in
+		/tmp)
+			case ${_dev} in
+			tmpfs|/dev/md[0-9]*)
+				return 0
+				;;
+			esac
+			;;
 		esac
 	done <<*EOF
 $(df /tmp)