Skip to content

Commit

Permalink
idtools: support libsubid 4
Browse files Browse the repository at this point in the history
the functions get_subuid_ranges and get_subgid_ranges were renamed
respectively to subid_get_uid_ranges and subid_get_gid_ranges in
libsubid version 4.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Dec 10, 2021
1 parent 4cd5fa1 commit 6529a6d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/idtools/idtools_supported.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ struct subid_range get_range(struct subid_range *ranges, int i)
{
return ranges[i];
}
#if !defined(SUBID_ABI_MAJOR) || (SUBID_ABI_MAJOR < 4)
# define subid_get_uid_ranges get_subuid_ranges
# define subid_get_gid_ranges get_subgid_ranges
#endif
*/
import "C"

Expand All @@ -32,9 +38,9 @@ func readSubid(username string, isUser bool) (ranges, error) {
var nRanges C.int
var cRanges *C.struct_subid_range
if isUser {
nRanges = C.get_subuid_ranges(cUsername, &cRanges)
nRanges = C.subid_get_uid_ranges(cUsername, &cRanges)
} else {
nRanges = C.get_subgid_ranges(cUsername, &cRanges)
nRanges = C.subid_get_gid_ranges(cUsername, &cRanges)
}
if nRanges < 0 {
return nil, errors.New("cannot read subids")
Expand Down

0 comments on commit 6529a6d

Please sign in to comment.