[Rt-commit] r8192 - rt/branches/3.7-EXPERIMENTAL-TUNIS/bin

ruz at bestpractical.com ruz at bestpractical.com
Tue Jul 17 13:39:41 EDT 2007


Author: ruz
Date: Tue Jul 17 13:39:40 2007
New Revision: 8192

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/bin/rt-mailgate.in

Log:
* when we pass a template into tempfile function, it tries to create
  file in the current dir, we want it to use system's one, just get rid
  of template as we really don't care much about its name

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/bin/rt-mailgate.in
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/bin/rt-mailgate.in	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/bin/rt-mailgate.in	Tue Jul 17 13:39:40 2007
@@ -180,9 +180,11 @@
 sub write_down_message {
     use File::Temp qw(tempfile);
 
-    my ($fh, $filename) = tempfile('rt-mailgate-XXXX', SUFIX => '.bin');
-    unless( $fh ) {
-        print STDERR "$0: couldn't create temp file, using memory\n";
+    local $@;
+    my ($fh, $filename) = eval { tempfile() };
+    if ( !$fh || $@ ) {
+        print STDERR "$0: Couldn't create temp file, using memory\n";
+        print STDERR "error: $@\n" if $@;
 
         my $message = \do { local (@ARGV, $/); <> };
         unless ( $$message =~ /\S/ ) {


More information about the Rt-commit mailing list