uid-range: make uid_map_search_root() take UIDRangeUsernsMode

This commit is contained in:
Mike Yuan
2025-01-11 15:53:15 +01:00
parent 8c2c8235a6
commit a0e3dbdef5
3 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -324,13 +324,13 @@ bool uid_range_equal(const UIDRange *a, const UIDRange *b) {
return true;
}
int uid_map_search_root(pid_t pid, const char *filename, uid_t *ret) {
int uid_map_search_root(pid_t pid, UIDRangeUsernsMode mode, uid_t *ret) {
int r;
assert(pid_is_valid(pid));
assert(filename);
assert(IN_SET(mode, UID_RANGE_USERNS_OUTSIDE, GID_RANGE_USERNS_OUTSIDE));
const char *p = procfs_file_alloca(pid, filename);
const char *p = procfs_file_alloca(pid, mode == UID_RANGE_USERNS_OUTSIDE ? "uid_map" : "gid_map");
_cleanup_fclose_ FILE *f = fopen(p, "re");
if (!f) {
if (errno != ENOENT)