Skip to content

Commit

Permalink
Check the vararg length before calling the function.
Browse files Browse the repository at this point in the history
  • Loading branch information
tongson committed Jan 21, 2015
1 parent 15bb766 commit 763e9e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/px/src/px.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ local Lua = {
unpack = table.unpack,
concat = table.concat,
remove = table.remove,
rename = os.rename
rename = os.rename,
select = select
}
local Cimicida = require"cimicida"
local Ppwd = require"posix.pwd"
Expand All @@ -30,7 +31,11 @@ local retry = function (fn)
return function (...)
local ret, err, errnum, errno, _
repeat
ret, err, errnum = fn(...)
if Lua.select("#", ...) == 0 then
ret, err, errnum = fn()
else
ret, err, errnum = fn(...)
end
if ret == -1 then
_, errno = Perrno.errno()
end
Expand Down

0 comments on commit 763e9e8

Please sign in to comment.