Commits

Shlomi Fish committed 5bb1d31

Now cleaning up the ipp.XXXXX tempdirs.

They used to lay on the file system and fill up the filesystem.

Comments (0)

Files changed (1)

src/wml_backend/p1_ipp/ipp.src

 use Getopt::Long 2.13;
 use IO::Handle 1.15;
 use IO::File 1.06;
-use File::Temp;
+use File::Temp qw/tempdir/;
+use File::Spec;
 
 #
 #   help functions
 #
 #   process the pre-loaded include files
 #
-$tmpdir = $ENV{'TMPDIR'} || '/tmp';
-my $tmpldir = ($ENV{'TMPDIR'} || '/tmp') . '/ipp.XXXXXX';
-$tmpdir = mkdtemp($tmpldir) or die "Unable to create temporary directory: $!\n";
-$tmpfile = $tmpdir . "/ipp.$$.tmp";
+my $tmpdir = tempdir('ipp.XXXXXXXX', 'CLEANUP' => 1,)
+    or die "Unable to create temporary directory: $!\n";
+$tmpfile = File::Spec->catfile($tmpdir, "ipp.$$.tmp");
+
 unlink($tmpfile);
 $tmp = new IO::File;
 $tmp->open(">$tmpfile") || error("cannot write into $tmpfile: $!");