diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-11-22 10:11:32 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-11-22 11:28:28 +0100 |
commit | 7f8a4f12dfea6f644f92788bd9b03983898e9d32 (patch) | |
tree | 20f8819557cc68249508ed4c507bb5756ddd21cc | |
parent | userbdctl: show 'mapped' user range only inside of userns (diff) | |
download | systemd-7f8a4f12dfea6f644f92788bd9b03983898e9d32.tar.xz systemd-7f8a4f12dfea6f644f92788bd9b03983898e9d32.zip |
userdbctl: fix counting
Fixes: #35294
-rw-r--r-- | src/userdb/userdbctl.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/userdb/userdbctl.c b/src/userdb/userdbctl.c index 6028a87827..19de87d01e 100644 --- a/src/userdb/userdbctl.c +++ b/src/userdb/userdbctl.c @@ -187,7 +187,7 @@ static const struct { }; static int table_add_uid_boundaries(Table *table, const UIDRange *p) { - int r; + int r, n_added = 0; assert(table); @@ -260,9 +260,11 @@ static int table_add_uid_boundaries(Table *table, const UIDRange *p) { TABLE_INT, 1); /* sort after any other entry with the same UID */ if (r < 0) return table_log_add_error(r); + + n_added += 2; } - return ELEMENTSOF(uid_range_table) * 2; + return n_added; } static int add_unavailable_uid(Table *table, uid_t start, uid_t end) { @@ -576,7 +578,7 @@ static int show_group(GroupRecord *gr, Table *table) { } static int table_add_gid_boundaries(Table *table, const UIDRange *p) { - int r; + int r, n_added = 0; assert(table); @@ -640,9 +642,11 @@ static int table_add_gid_boundaries(Table *table, const UIDRange *p) { TABLE_INT, 1); /* sort after any other entry with the same GID */ if (r < 0) return table_log_add_error(r); + + n_added += 2; } - return ELEMENTSOF(uid_range_table) * 2; + return n_added; } static int add_unavailable_gid(Table *table, uid_t start, uid_t end) { |