prosodyctl: Show real error if certificate config file can't be opened
authorKim Alvefur <zash@zash.se>
Sat, 22 Mar 2014 12:02:11 +0100
changeset 6035 1b5ca55bf895
parent 6034 ee14da71d3fc
child 6038 b3ceb7627e27
child 6040 b3b1c9da38fb
child 6045 a5b5bce71a11
prosodyctl: Show real error if certificate config file can't be opened
prosodyctl
--- 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("");