tag 332433 +patch
thanks
diff -u -p -Nr --exclude CVS cfengine-1.6.5.orig/bin/cfmail cfengine-1.6.5/bin/cfmail
--- cfengine-1.6.5.orig/bin/cfmail	2002-06-20 15:38:34.000000000 +0200
+++ cfengine-1.6.5/bin/cfmail	2005-09-23 12:50:51.000000000 +0200
@@ -20,8 +20,6 @@ if ($< != 0)
    die "Only root can use cfmail.\n";
    }
 
-$tmpfile = "/tmp/cfmail.$$";
-
 #
 # Set this to the address you want the mail to appear to
 # have come from. Don't set it to [EMAIL PROTECTED], set it
@@ -36,7 +34,7 @@ $flags = "-f$sysadm";
 
 &CommandOptions();
 
-open(SND,"| /usr/sbin/sendmail $flags $destination") || die "Can't open $tmpfile for writing\n";
+open(SND,"| /usr/sbin/sendmail $flags $destination") || die "Can't open pipe to sendmail\n";
 
 print SND "From: $sysadm\n";
 print SND "To: $destination\n";
diff -u -p -Nr --exclude CVS cfengine-1.6.5.orig/bin/cfmailfilter cfengine-1.6.5/bin/cfmailfilter
--- cfengine-1.6.5.orig/bin/cfmailfilter	1997-07-23 16:50:37.000000000 +0200
+++ cfengine-1.6.5/bin/cfmailfilter	2005-09-23 12:50:51.000000000 +0200
@@ -9,8 +9,9 @@
 
 PATH=/usr/bin:/bin:/sbin ; export PATH
 
-tmpfile=/tmp/new-mail-from-cfengine
-cftmpdir=/tmp
+tmpfile=`mktemp -t tempfile.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
+trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
+cftmpdir=${TMPDIR-/tmp}
 
 cat > $tmpfile
 
@@ -24,10 +25,4 @@ if test `diff $cftmpdir/$machine.new $cf
 
  mv $cftmpdir/$machine.new $cftmpdir/$machine
 
- #
- # This next piece could be replaced by a cgi script to show the results
- #
-
- ( echo "$machineline"; echo "" ; cat $cftmpdir/$machine ) | mail [EMAIL PROTECTED]
-
 fi
diff -u -p -Nr --exclude CVS cfengine-1.6.5.orig/contrib/cfcron.in cfengine-1.6.5/contrib/cfcron.in
--- cfengine-1.6.5.orig/contrib/cfcron.in	2000-05-06 06:06:33.000000000 +0200
+++ cfengine-1.6.5/contrib/cfcron.in	2005-09-23 12:50:51.000000000 +0200
@@ -24,8 +24,9 @@ [EMAIL PROTECTED]@
 [EMAIL PROTECTED]@
 FILECF="${CFINPUTS:-"@pkgdata@"}/cron.cf"
 [EMAIL PROTECTED]@/cfengine
-TMPFILE=/tmp/cfwrap.$$
-OLDFILE=/tmp/cfwrap.o
+TMPFILE=`mktemp -t tempfile.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
+trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
+OLDFILE=${TMPDIR-/tmp}/cfwrap.o
 NOCONF=$prefix/etc/noconf
 USER=`/usr/bin/whoami`
 HOST=`/usr/bin/hostname`
diff -u -p -Nr --exclude CVS cfengine-1.6.5.orig/contrib/vicf.in cfengine-1.6.5/contrib/vicf.in
--- cfengine-1.6.5.orig/contrib/vicf.in	2002-06-20 15:38:34.000000000 +0200
+++ cfengine-1.6.5/contrib/vicf.in	2005-09-23 12:30:47.000000000 +0200
@@ -56,12 +56,13 @@ EdFile () {
     while [ "$editfile" = "n" ]
     do
 	${EDITOR} ${CFINPUTS}/.${file}.lock
-	cp /dev/null /tmp/cfparse.$$
-	$sbindir/cfengine --no-warn --parse-only --file ${CFINPUTS}/.${file}.lock > /tmp/cfparse.$$ 2>&1
-	if [ -s /tmp/cfparse.$$ ]
+        tmpfile=`mktemp -t tempfile.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1;  }
+        trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15
+	$sbindir/cfengine --no-warn --parse-only --file ${CFINPUTS}/.${file}.lock > $tmpfile 2>&1
+	if [ -s $tmpfile ]
 	then
 		echo PARSE ERROR IN NEW INPUT-FILE:
-		cat /tmp/cfparse.$$
+		cat $tmpfile
 		printf "Re-edit file? (Y/n) "
 		read answer
 		if [ "$answer" = "n" ]
@@ -75,7 +76,7 @@ EdFile () {
 	fi
     done
 
-    rm -f /tmp/cfparse.$$ ${CFINPUTS}/.${file}.lock
+    rm -f ${CFINPUTS}/.${file}.lock
 }
 
 force=n

Reply via email to