Date: Fri, 8 Aug 2008 00:30:03 GMT From: Alex Kozlov <spam@rm-rf.kiev.ua> To: freebsd-rc@FreeBSD.org Subject: Re: bin/126324: [patch] rc.d/tmp: Prevent mounting /tmp in second time Message-ID: <200808080030.m780U3Yu057813@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/126324; it has been noted by GNATS. From: Alex Kozlov <spam@rm-rf.kiev.ua> To: Kris Kennaway <kris@FreeBSD.org>, bug-followup@freebsd.org, spam@rm-rf.kiev.ua Cc: Subject: Re: bin/126324: [patch] rc.d/tmp: Prevent mounting /tmp in second time Date: Fri, 8 Aug 2008 03:25:19 +0300 On Thu, Aug 07, 2008 at 06:50:06PM +0000, Alex Kozlov wrote: > The following reply was made to PR bin/126324; it has been noted by GNATS. > > From: Alex Kozlov <spam@rm-rf.kiev.ua> > To: Kris Kennaway <kris@FreeBSD.org>, bug-followup@freebsd.org, > spam@rm-rf.kiev.ua > Cc: > Subject: Re: bin/126324: [patch] rc.d/tmp: Prevent mounting /tmp in second > time > Date: Thu, 7 Aug 2008 21:49:03 +0300 > > On Thu, Aug 07, 2008 at 07:25:49PM +0200, Kris Kennaway wrote: > > Alex Kozlov wrote: > > > > > Well, as alternative We can just don't touch /tmp if it already mounted. > > This is much better on general grounds. > I post patch for review soon. Index: src/etc/rc.d/tmp @@ -37,13 +37,20 @@ load_rc_config $name +is_mounted () +{ + /sbin/mount | /usr/bin/grep -ql $1 && return 0 + return 1 +} + # If we do not have a writable /tmp, create a memory # filesystem for /tmp. If /tmp is a symlink (e.g. to /var/tmp, -# then it should already be writable). +# then it should already be writable). If we already have /tmp +# mounted somewhere, doing nothing. # case "${tmpmfs}" in [Yy][Ee][Ss]) - mount_md ${tmpsize} /tmp "${tmpmfs_flags}" + is_mounted /tmp || mount_md ${tmpsize} /tmp "${tmpmfs_flags}" chmod 01777 /tmp ;; [Nn][Oo]) @@ -57,7 +64,7 @@ echo "dropping into shell, ^D to continue anyway." /bin/sh else - mount_md ${tmpsize} /tmp "${tmpmfs_flags}" + is_mounted /tmp || mount_md ${tmpsize} /tmp "${tmpmfs_flags}" chmod 01777 /tmp fi fi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808080030.m780U3Yu057813>