prosodyctl: Show real error if certificate config file can't be opened
authorKim Alvefur <zash@zash.se>
Sat, 22 Mar 2014 11:02:11 +0000 (12:02 +0100)
committerKim Alvefur <zash@zash.se>
Sat, 22 Mar 2014 11:02:11 +0000 (12:02 +0100)
prosodyctl

index 247b099a94f73a30109a7139e45103a9fe32332f..d341a75bbabb7a5e131626e80f6628df85ff74b0 100755 (executable)
@@ -684,7 +684,12 @@ function cert_commands.config(arg)
                                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("");