summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gitano/admincommand.lua2
-rw-r--r--lib/gitano/usercommand.lua3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/gitano/admincommand.lua b/lib/gitano/admincommand.lua
index be6bf0a..5f1bcf9 100644
--- a/lib/gitano/admincommand.lua
+++ b/lib/gitano/admincommand.lua
@@ -129,6 +129,7 @@ local function update_user_in_htpasswd(conf, userfrom, userto)
return
end
local htpasswd_path = os.getenv("HOME") .. "/htpasswd"
+ local lock = util.lockfile(htpasswd_path .. ".lock")
local fh = io.open(htpasswd_path, "r")
if not fh then return end
local to_write = {}
@@ -151,6 +152,7 @@ local function update_user_in_htpasswd(conf, userfrom, userto)
log.warn(i18n.expand("ERROR_UNABLE_TO_RENAME_INTO_PLACE",
{what="htpasswd", reason=luxio.strerror(errno)}))
end
+ util.unlockfile(lock)
end
local builtin_user_short = "Manage users in Gitano"
diff --git a/lib/gitano/usercommand.lua b/lib/gitano/usercommand.lua
index 5d3d7ac..af7141c 100644
--- a/lib/gitano/usercommand.lua
+++ b/lib/gitano/usercommand.lua
@@ -282,6 +282,7 @@ end
local function update_htpasswd(user, passwd)
local htpasswd_path = os.getenv("HOME") .. "/htpasswd"
+ local lock = util.lockfile(htpasswd_path .. ".lock")
local flags = io.open(htpasswd_path, "r") and "-i" or "-ic"
local exit_code
@@ -303,7 +304,7 @@ local function update_htpasswd(user, passwd)
_, exit_code = proc:wait()
end
-
+ util.unlockfile(lock)
return exit_code == 0
end