Diff

util/datamanager.lua @ 7996:f4c0fb54e16c

util.datamanager: Remove check for file non-existence since ENOENT tells us that already
author Kim Alvefur <zash@zash.se>
date Wed, 22 Mar 2017 12:02:52 +0100
parent 7995:b99404a340fc
child 8011:f8ba814fe029
line wrap: on
line diff
--- a/util/datamanager.lua	Wed Mar 22 12:00:21 2017 +0100
+++ b/util/datamanager.lua	Wed Mar 22 12:02:52 2017 +0100
@@ -132,15 +132,8 @@
 			-- No such file, ok to ignore
 			return nil;
 		end
-		local mode = lfs.attributes(getpath(username, host, datastore), "mode");
-		if not mode then
-			log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
-			return nil;
-		else -- file exists, but can't be read
-			-- TODO more detailed error checking and logging?
-			log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
-			return nil, "Error reading storage";
-		end
+		log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
+		return nil, "Error reading storage";
 	end
 
 	local success, ret = pcall(data);
@@ -306,15 +299,8 @@
 			-- No such file, ok to ignore
 			return nil;
 		end
-		local mode = lfs.attributes(getpath(username, host, datastore, "list"), "mode");
-		if not mode then
-			log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
-			return nil;
-		else -- file exists, but can't be read
-			-- TODO more detailed error checking and logging?
-			log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
-			return nil, "Error reading storage";
-		end
+		log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
+		return nil, "Error reading storage";
 	end
 
 	local success, ret = pcall(data);