util.datamanager: Remove check for file non-existence since ENOENT tells us that already
authorKim Alvefur <zash@zash.se>
Wed, 22 Mar 2017 12:02:52 +0100
changeset 7999 f4c0fb54e16c
parent 7998 b99404a340fc
child 8000 aca13c433e45
util.datamanager: Remove check for file non-existence since ENOENT tells us that already
util/datamanager.lua
--- 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);