Software / code / prosody
Comparison
prosodyctl @ 8099:04eaaeb89a05
prosodyctl: Rename variable for soft-require success to improve readability
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 19 Apr 2017 20:38:55 +0200 |
| parent | 8098:ee1c81450345 |
| child | 8100:1773559b03a8 |
comparison
equal
deleted
inserted
replaced
| 8098:ee1c81450345 | 8099:04eaaeb89a05 |
|---|---|
| 134 | 134 |
| 135 -- Switch away from root and into the prosody user -- | 135 -- Switch away from root and into the prosody user -- |
| 136 local switched_user, current_uid; | 136 local switched_user, current_uid; |
| 137 | 137 |
| 138 local want_pposix_version = "0.4.0"; | 138 local want_pposix_version = "0.4.0"; |
| 139 local ok, pposix = pcall(require, "util.pposix"); | 139 local have_pposix, pposix = pcall(require, "util.pposix"); |
| 140 | 140 |
| 141 if ok and pposix then | 141 if have_pposix and pposix then |
| 142 if pposix._VERSION ~= want_pposix_version then print(string.format("Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version)); return; end | 142 if pposix._VERSION ~= want_pposix_version then print(string.format("Unknown version (%s) of binary pposix module, expected %s", tostring(pposix._VERSION), want_pposix_version)); return; end |
| 143 current_uid = pposix.getuid(); | 143 current_uid = pposix.getuid(); |
| 144 local arg_root = arg[1] == "--root"; | 144 local arg_root = arg[1] == "--root"; |
| 145 if arg_root then table.remove(arg, 1); end | 145 if arg_root then table.remove(arg, 1); end |
| 146 if current_uid == 0 and config.get("*", "run_as_root") ~= true and not arg_root then | 146 if current_uid == 0 and config.get("*", "run_as_root") ~= true and not arg_root then |