Comparison

util/datamanager.lua @ 6998:86607fe755b6

util.datamanager: Handle potential error from :write() call
author Kim Alvefur <zash@zash.se>
date Fri, 11 Dec 2015 20:26:04 +0100
parent 6997:0ab228bc21c6
child 6999:0ad66d12113a
comparison
equal deleted inserted replaced
6997:0ab228bc21c6 6998:86607fe755b6
230 if f:seek() ~= pos then 230 if f:seek() ~= pos then
231 log("debug", "fallocate() changed file position"); 231 log("debug", "fallocate() changed file position");
232 f:seek("set", pos); 232 f:seek("set", pos);
233 end 233 end
234 234
235 if ok then 235 ok, msg = f:write(data);
236 f:write(data); 236 if not ok then
237 else 237 f:close();
238 return ok, msg; 238 return ok, msg;
239 end 239 end
240 240
241 ok, msg = f:close(); 241 ok, msg = f:close();
242 if not ok then 242 if not ok then