From 0114fe9f2b5fe9484f729a64e5137b1731491180 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 6 Mar 2018 10:43:33 -0500 Subject: [PATCH] Bug 20342: Use File::Temp to get temp dir --- tools/stage-marc-import.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/stage-marc-import.pl b/tools/stage-marc-import.pl index ee698a0..399e54b 100755 --- a/tools/stage-marc-import.pl +++ b/tools/stage-marc-import.pl @@ -31,6 +31,7 @@ use CGI qw ( -utf8 ); use CGI::Cookie; use MARC::File::USMARC; use Net::Server::Daemonize qw(daemonize); +use File::Temp qw(tempdir); # Koha modules used use C4::Context; @@ -120,10 +121,11 @@ if ($completedJobID) { exit 0; } elsif (defined $pid) { # Daemonize the child process os the parent will print its output - my $pidfile = "/tmp/async$$.pid"; # deamonize requires a pid file even though it is supposed to be optional + # deamonize requires a pid file even though it is supposed to be optional + my $dir = tempdir( CLEANUP => 1 ); + my $pidfile = "$dir/async$$.pid"; my @current_user = getpwuid($<); daemonize( $current_user[2], $current_user[3], $pidfile ); - unlink($pidfile); # otherwise it doesn't go away # child # close STDOUT to signal to Apache that # we're now running in the background -- 2.10.2