mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-06 13:17:44 +03:00
userdbctl: fix counting
Fixes: #35294
(cherry picked from commit 7f8a4f12dfea6f644f92788bd9b03983898e9d32)
(cherry picked from commit 3d85366ab802aea92ade6a544b63ef73fff69e4a)
(cherry picked from commit 9d0e453244
)
This commit is contained in:
parent
de65927ffe
commit
20bf8b00c3
@ -178,7 +178,7 @@ static const struct {
|
||||
};
|
||||
|
||||
static int table_add_uid_boundaries(Table *table, const UidRange *p) {
|
||||
int r;
|
||||
int r, n_added = 0;
|
||||
|
||||
assert(table);
|
||||
|
||||
@ -248,9 +248,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) {
|
||||
@ -541,7 +543,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);
|
||||
|
||||
@ -606,9 +608,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) {
|
||||
|
Loading…
Reference in New Issue
Block a user