Changeset

1172:1e8b793d8ff9

mod_lastlog: Return a non-zero exit code if no lastlog records were found
author Kim Alvefur <zash@zash.se>
date Wed, 28 Aug 2013 18:42:10 +0200
parents 1171:a18effacd384
children 1173:8999967fc4fe
files mod_lastlog/mod_lastlog.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_lastlog/mod_lastlog.lua	Wed Aug 28 10:37:23 2013 +0100
+++ b/mod_lastlog/mod_lastlog.lua	Wed Aug 28 18:42:10 2013 +0200
@@ -54,7 +54,7 @@
 	end
 	local user, host = jid.prepped_split(table.remove(arg, 1));
 	require"core.storagemanager".initialize_host(host);
-	local lastlog = assert(datamanager.load(user, host, "lastlog"));
+	local lastlog = datamanager.load(user, host, "lastlog");
 	if lastlog then
 		print(("Last %s: %s"):format(lastlog.event or "login",
 		lastlog.timestamp and os.date("%Y-%m-%d %H:%M:%S", lastlog.timestamp) or "<unknown>"));
@@ -63,6 +63,7 @@
 		end
 	else
 		print("No record found");
+		return 1;
 	end
 	return 0;
 end