Software /
code /
prosody
Comparison
util/datamanager.lua @ 6575:bdaadf70a48f
util.datamanager: Check that the global 'prosody' exists before using it (fixes nil indexing in use outside of prosody)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 20 Feb 2015 19:00:01 +0100 |
parent | 5441:6a5c622cc6d4 |
child | 6644:6cb6855f60df |
comparison
equal
deleted
inserted
replaced
6574:cd0088c73daf | 6575:bdaadf70a48f |
---|---|
161 if f then f:close(); end | 161 if f then f:close(); end |
162 os_remove(scratch); | 162 os_remove(scratch); |
163 return nil, msg; | 163 return nil, msg; |
164 end | 164 end |
165 | 165 |
166 if prosody.platform ~= "posix" then | 166 if prosody and prosody.platform ~= "posix" then |
167 -- os.rename does not overwrite existing files on Windows | 167 -- os.rename does not overwrite existing files on Windows |
168 -- TODO We could use Transactional NTFS on Vista and above | 168 -- TODO We could use Transactional NTFS on Vista and above |
169 function atomic_store(filename, data) | 169 function atomic_store(filename, data) |
170 local f, err = io_open(filename, "w"); | 170 local f, err = io_open(filename, "w"); |
171 if not f then return f, err; end | 171 if not f then return f, err; end |