Skip to content

Commit ce95c6d

Browse files
committed
for -> do while
adapt tiann#2757 to old compilers
1 parent a8b4075 commit ce95c6d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kernel/throne_tracker.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,13 @@ FILLDIR_RETURN_TYPE user_de_actor(MY_ACTOR_CTX_ARG, const char *name,
185185
return FILLDIR_ACTOR_CONTINUE;
186186

187187
uid_t uid = 0;
188-
for (int i = 0; i < namelen; i++) {
188+
int i = 0;
189+
do {
189190
if (name[i] < '0' || name[i] > '9')
190191
return FILLDIR_ACTOR_CONTINUE;
191192
uid = uid * 10 + (name[i] - '0');
192-
}
193+
i++;
194+
} (while i < namelen);
193195

194196
if (data->count >= data->max_users)
195197
return FILLDIR_ACTOR_STOP;
@@ -386,7 +388,8 @@ int scan_user_data_for_uids(struct list_head *uid_list)
386388
}
387389

388390
// Scan each user's data directory
389-
for (size_t i = 0; i < active_users; i++) {
391+
size_t i = 0;
392+
do {
390393
uid_t user_id = user_ids[i];
391394
size_t packages_found = 0;
392395
size_t errors_count = 0;
@@ -401,7 +404,8 @@ int scan_user_data_for_uids(struct list_head *uid_list)
401404

402405
total_packages += packages_found;
403406
total_errors += errors_count;
404-
}
407+
i++;
408+
} while ( i < active_users) ;
405409

406410
if (total_errors > 0) {
407411
pr_warn("UserDE UID: Encountered %zu errors while scanning user data directories\n",

0 commit comments

Comments
 (0)