Skip to content

Commit 9cedb7d

Browse files
author
HD Moore
committed
Lands rapid7#5585, create the payloads.json on first use
2 parents a2a231c + 3141d4e commit 9cedb7d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/rex/json_hash_file.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ def initialize(path)
1616
@lock = Mutex.new
1717
@hash = {}
1818
@last = 0
19-
::FileUtils.mkdir_p(::File.dirname(path))
20-
synced_update
2119
end
2220

2321
def [](k)
@@ -53,6 +51,7 @@ def clear
5351
# Save the file, but prevent thread & process contention
5452
def synced_update(&block)
5553
@lock.synchronize do
54+
::FileUtils.mkdir_p(::File.dirname(path))
5655
::File.open(path, ::File::RDWR|::File::CREAT) do |fd|
5756
fd.flock(::File::LOCK_EX)
5857

@@ -81,7 +80,6 @@ def synced_update(&block)
8180
end
8281
end
8382

84-
8583
def parse_data(data)
8684
return {} if data.to_s.strip.length == 0
8785
begin

0 commit comments

Comments
 (0)