aboutsummaryrefslogtreecommitdiff
path: root/src/utils.nim
diff options
context:
space:
mode:
authorzqqw2020-08-05 13:53:43 +0000
committerGitHub2020-08-05 13:53:43 +0000
commitf2a93bea278e9f43cad98ca8e74f9a423f36e333 (patch)
tree721da2b78793860b6fb020194efe2eccea88bac9 /src/utils.nim
parentb2321b0ded6f4a9803daf9dbcbd88d56321a9305 (diff)
parent4bbf3dc2097f1de206fa053fac32f675d4ae2927 (diff)
Merge pull request #4 from shirleyquirk/lc_useVersion
I mean it this time
Diffstat (limited to 'src/utils.nim')
-rw-r--r--src/utils.nim7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/utils.nim b/src/utils.nim
index 25d1b83..da9618b 100644
--- a/src/utils.nim
+++ b/src/utils.nim
@@ -211,7 +211,8 @@ proc forkWaitRedirect*(call: () -> int): tuple[output: seq[string], code: int] =
proc getgrouplist*(user: cstring, group: Gid, groups: ptr cint, ngroups: var cint): cint
{.importc, header: "<grp.h>".}
-proc setgroups*(size: int, groups: ptr cint): cint
+
+proc setgroups*(size: csize_t, groups: ptr cint): cint
{.importc, header: "<grp.h>".}
proc getUser(uid: int): User =
@@ -253,8 +254,8 @@ proc dropPrivileges*(): bool =
if initialUser.isSome:
let user = initialUser.unsafeGet
var groups = user.groups.map(x => x.cint)
-
- if setgroups(user.groups.len, addr(groups[0])) < 0:
+
+ if setgroups(cast[csize_t](user.groups.len), addr(groups[0])) < 0:
return false
if setgid((Gid) user.gid) != 0:
return false