From 9148068acc495d46443e8450806879a10b047102 Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Wed, 3 Mar 2010 04:58:12 +0000 Subject: [PATCH] pass unlink_now flag to close for Tempfile instances git-svn-id: file:///home/svn/framework3/trunk@8697 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/ui/console/command_dispatcher/db.rb | 3 ++- lib/rex/assembly/nasm.rb | 21 +++++++++---------- .../console/command_dispatcher/stdapi/fs.rb | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/msf/ui/console/command_dispatcher/db.rb b/lib/msf/ui/console/command_dispatcher/db.rb index ecf4ac2808..5b0199c528 100644 --- a/lib/msf/ui/console/command_dispatcher/db.rb +++ b/lib/msf/ui/console/command_dispatcher/db.rb @@ -966,8 +966,9 @@ class Db # print_status("NMAP: #{line.strip}") # end - ::File.unlink(fo.path) + fo.close(true) framework.db.import_nmap_xml_file(fd.path) + fd.close(true) end # diff --git a/lib/rex/assembly/nasm.rb b/lib/rex/assembly/nasm.rb index b8b5eb93a6..b19cb1c6e6 100644 --- a/lib/rex/assembly/nasm.rb +++ b/lib/rex/assembly/nasm.rb @@ -16,22 +16,22 @@ class Nasm @@nasm_path = 'nasm' @@ndisasm_path = 'ndisasm' - + # # Ensures that the nasm environment is sane. # def self.check - @@nasm_path = + @@nasm_path = Rex::FileUtils.find_full_path('nasm') || Rex::FileUtils.find_full_path('nasm.exe') || Rex::FileUtils.find_full_path('nasmw.exe') || raise(RuntimeError, "No nasm installation was found.") - - @@ndisasm_path = + + @@ndisasm_path = Rex::FileUtils.find_full_path('ndisasm') || Rex::FileUtils.find_full_path('ndisasm.exe') || Rex::FileUtils.find_full_path('ndisasmw.exe') || - raise(RuntimeError, "No ndisasm installation was found.") + raise(RuntimeError, "No ndisasm installation was found.") end # @@ -60,8 +60,7 @@ class Nasm # Remove temporary files File.unlink(opath) - File.unlink(tpath) - tmp.close + tmp.close(true) rv end @@ -71,10 +70,10 @@ class Nasm # def self.disassemble(raw) check - + tmp = Tempfile.new('nasmout') tfd = File.open(tmp.path, "wb") - + tfd.write(raw) tfd.flush() tfd.close @@ -90,7 +89,7 @@ class Nasm p.close end - tmp.close + tmp.close(true) o end @@ -98,4 +97,4 @@ class Nasm end end -end \ No newline at end of file +end diff --git a/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb b/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb index d0293ca021..5e015587f4 100644 --- a/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb +++ b/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb @@ -211,7 +211,7 @@ class Console::CommandDispatcher::Stdapi::Fs end # Get rid of that pesky temporary file - ::File.unlink(temp_path) + temp_path.close(true) end #