Diff

prosodyctl @ 6035:1b5ca55bf895

prosodyctl: Show real error if certificate config file can't be opened
author Kim Alvefur <zash@zash.se>
date Sat, 22 Mar 2014 12:02:11 +0100
parent 5547:f306daf2bf6d
child 6038:b3ceb7627e27
child 6324:c9730926002b
line wrap: on
line diff
--- a/prosodyctl	Sat Mar 22 12:42:01 2014 +0100
+++ b/prosodyctl	Sat Mar 22 12:02:11 2014 +0100
@@ -684,7 +684,12 @@
 				conf.distinguished_name[k] = nv ~= "." and nv or nil;
 			end
 		end
-		local conf_file = io.open(conf_filename, "w");
+		local conf_file, err = io.open(conf_filename, "w");
+		if not conf_file then
+			show_warning("Could not open OpenSSL config file for writing");
+			show_warning(err);
+			os.exit(1);
+		end
 		conf_file:write(conf:serialize());
 		conf_file:close();
 		print("");