pass unlink_now flag to close for Tempfile instances

git-svn-id: file:///home/svn/framework3/trunk@8697 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Joshua Drake 2010-03-03 04:58:12 +00:00
parent d86575701d
commit 9148068acc
3 changed files with 13 additions and 13 deletions

View File

@ -966,8 +966,9 @@ class Db
# print_status("NMAP: #{line.strip}") # print_status("NMAP: #{line.strip}")
# end # end
::File.unlink(fo.path) fo.close(true)
framework.db.import_nmap_xml_file(fd.path) framework.db.import_nmap_xml_file(fd.path)
fd.close(true)
end end
# #

View File

@ -16,22 +16,22 @@ class Nasm
@@nasm_path = 'nasm' @@nasm_path = 'nasm'
@@ndisasm_path = 'ndisasm' @@ndisasm_path = 'ndisasm'
# #
# Ensures that the nasm environment is sane. # Ensures that the nasm environment is sane.
# #
def self.check def self.check
@@nasm_path = @@nasm_path =
Rex::FileUtils.find_full_path('nasm') || Rex::FileUtils.find_full_path('nasm') ||
Rex::FileUtils.find_full_path('nasm.exe') || Rex::FileUtils.find_full_path('nasm.exe') ||
Rex::FileUtils.find_full_path('nasmw.exe') || Rex::FileUtils.find_full_path('nasmw.exe') ||
raise(RuntimeError, "No nasm installation was found.") raise(RuntimeError, "No nasm installation was found.")
@@ndisasm_path = @@ndisasm_path =
Rex::FileUtils.find_full_path('ndisasm') || Rex::FileUtils.find_full_path('ndisasm') ||
Rex::FileUtils.find_full_path('ndisasm.exe') || Rex::FileUtils.find_full_path('ndisasm.exe') ||
Rex::FileUtils.find_full_path('ndisasmw.exe') || Rex::FileUtils.find_full_path('ndisasmw.exe') ||
raise(RuntimeError, "No ndisasm installation was found.") raise(RuntimeError, "No ndisasm installation was found.")
end end
# #
@ -60,8 +60,7 @@ class Nasm
# Remove temporary files # Remove temporary files
File.unlink(opath) File.unlink(opath)
File.unlink(tpath) tmp.close(true)
tmp.close
rv rv
end end
@ -71,10 +70,10 @@ class Nasm
# #
def self.disassemble(raw) def self.disassemble(raw)
check check
tmp = Tempfile.new('nasmout') tmp = Tempfile.new('nasmout')
tfd = File.open(tmp.path, "wb") tfd = File.open(tmp.path, "wb")
tfd.write(raw) tfd.write(raw)
tfd.flush() tfd.flush()
tfd.close tfd.close
@ -90,7 +89,7 @@ class Nasm
p.close p.close
end end
tmp.close tmp.close(true)
o o
end end
@ -98,4 +97,4 @@ class Nasm
end end
end end
end end

View File

@ -211,7 +211,7 @@ class Console::CommandDispatcher::Stdapi::Fs
end end
# Get rid of that pesky temporary file # Get rid of that pesky temporary file
::File.unlink(temp_path) temp_path.close(true)
end end
# #