diff options
author | nectar <nectar@FreeBSD.org> | 2004-08-16 16:37:06 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2004-08-16 16:37:06 +0000 |
commit | 455e6a16528b332f31ed1e68b965ccc61bdce71d (patch) | |
tree | fe19f97c74c4b048279486e4f5327a78b8c37e30 /etc/rc.d/jail | |
parent | afd3ab767669f54bb08a5ea27f1025423b9b1476 (diff) | |
download | FreeBSD-src-455e6a16528b332f31ed1e68b965ccc61bdce71d.zip FreeBSD-src-455e6a16528b332f31ed1e68b965ccc61bdce71d.tar.gz |
Create temporary files safely.
Submitted by: Jon Passki <cykyc@yahoo.com>
Diffstat (limited to 'etc/rc.d/jail')
-rw-r--r-- | etc/rc.d/jail | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/etc/rc.d/jail b/etc/rc.d/jail index 32ce321..f344e96 100644 --- a/etc/rc.d/jail +++ b/etc/rc.d/jail @@ -122,6 +122,8 @@ jail_start() echo '.' echo -n 'Starting jails:' + _tmp_dir=`mktemp -d /tmp/jail.XXXXXXXX` || \ + err 3 "$name: Can't create temp dir, exiting..." for _jail in ${jail_list} do init_variables $_jail @@ -155,7 +157,7 @@ jail_start() mount -t procfs proc "${jail_procdir}" fi fi - _tmp_jail=/tmp/jail.$$ + _tmp_jail=${_tmp_dir}/jail.$$ jail -i ${jail_rootdir} ${jail_hostname} \ ${jail_ip} ${jail_exec} > ${_tmp_jail} 2>&1 [ "$?" -eq 0 ] && echo -n " $jail_hostname" @@ -164,6 +166,7 @@ jail_start() rm -f ${_tmp_jail} echo ${_jail_id} > /var/run/jail_${_jail}.id done + rmdir ${_tmp_dir} echo '.' } |