summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
606a17a)
appending a suffix to a safely-created temporary file to do other stuff is not
necessarily a good idea. Create a directory safely instead.
#!/bin/sh
# Yes, that's POSIX sh, not bash!
#!/bin/sh
# Yes, that's POSIX sh, not bash!
-tmpnam=`mktemp`
-conffile=${tmpnam}.conf
-pidfile=${tmpnam}.pid
+tmpdir=`mktemp -d`
+conffile=${tmpdir}/nbd.conf
+pidfile=${tmpdir}/nbd.pid
+tmpnam=${tmpdir}/nbd.dd
if [ -f ${pidfile} ]
then
kill `cat ${pidfile}`
if [ -f ${pidfile} ]
then
kill `cat ${pidfile}`
else
kill $PID
fi
if [ -z "$2" ]
then
else
kill $PID
fi
if [ -z "$2" ]
then
- rm -f $tmpnam ${conffile}
if [ -f ${pidfile} ]
then
kill `cat ${pidfile}`
if [ -f ${pidfile} ]
then
kill `cat ${pidfile}`
else
kill $PID
fi
if [ -z "$2" ]
then
else
kill $PID
fi
if [ -z "$2" ]
then
- rm -f $tmpnam ${conffile}
fi
if [ $retval -ne 0 ]
then
fi
if [ $retval -ne 0 ]
then