prosodyctl: Verify that 'pidfile' is a string, show friendly error otherwise
authorKim Alvefur <zash@zash.se>
Tue, 26 Aug 2014 10:00:51 +0000 (12:00 +0200)
committerKim Alvefur <zash@zash.se>
Tue, 26 Aug 2014 10:00:51 +0000 (12:00 +0200)
prosodyctl
util/prosodyctl.lua

index 38dac363250dc2e59ea4b7de9115a07eb3255c37..8580aaf69484b56184f0e2a0f57225bc846542ff 100755 (executable)
@@ -220,6 +220,7 @@ local error_messages = setmetatable({
                ["no-such-host"] = "The given hostname does not exist in the config";
                ["unable-to-save-data"] = "Unable to store, perhaps you don't have permission?";
                ["no-pidfile"] = "There is no 'pidfile' option in the configuration file, see http://prosody.im/doc/prosodyctl#pidfile for help";
+               ["invalid-pidfile"] = "The 'pidfile' option in the configuration file is not a string, see http://prosody.im/doc/prosodyctl#pidfile for help";
                ["no-posix"] = "The mod_posix module is not enabled in the Prosody config file, see http://prosody.im/doc/prosodyctl for more info";
                ["no-such-method"] = "This module has no commands";
                ["not-running"] = "Prosody is not running";
index b80a69f26eaafab55be94e4a2b47b65130e9818a..c6fe1986718b87e964ff12ac9dac09d6fe5ad4c5 100644 (file)
@@ -188,6 +188,10 @@ function getpid()
        if not pidfile then
                return false, "no-pidfile";
        end
+
+       if type(pidfile) ~= "string" then
+               return false, "invalid-pidfile";
+       end
        
        local modules_enabled = set.new(config.get("*", "modules_enabled"));
        if not modules_enabled:contains("posix") then