From 655b7082b176d20bc86e25188d99b354bab363b3 Mon Sep 17 00:00:00 2001 From: "Jonathan M. Henson" Date: Fri, 27 Oct 2023 13:05:51 -0700 Subject: [PATCH] Try this then. --- source/linux/system_info.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/linux/system_info.c b/source/linux/system_info.c index 6b2c7972a..42eb06ccc 100644 --- a/source/linux/system_info.c +++ b/source/linux/system_info.c @@ -129,17 +129,17 @@ uint16_t aws_get_cpu_group_count() { uint16_t count = 0; - const struct aws_directory_entry *dir_entry = aws_directory_entry_iterator_get_value(dir_iter); + do { + const struct aws_directory_entry *dir_entry = aws_directory_entry_iterator_get_value(dir_iter); + if (dir_entry) { + struct aws_byte_cursor search_cur = aws_byte_cursor_from_c_str("node"); + if ((dir_entry->file_type & (AWS_FILE_TYPE_SYM_LINK | AWS_FILE_TYPE_DIRECTORY)) && + aws_byte_cursor_starts_with_ignore_case(&dir_entry->path, &search_cur)) { + count++; + } - while (dir_entry) { - struct aws_byte_cursor search_cur = aws_byte_cursor_from_c_str("node"); - if ((dir_entry->file_type & (AWS_FILE_TYPE_SYM_LINK | AWS_FILE_TYPE_DIRECTORY)) && - aws_byte_cursor_starts_with_ignore_case(&dir_entry->path, &search_cur)) { - count++; } - aws_directory_entry_iterator_next(dir_iter); - dir_entry = aws_directory_entry_iterator_get_value(dir_iter); - } + } while (aws_directory_entry_iterator_next(dir_iter) == AWS_OP_SUCCESS); aws_directory_entry_iterator_destroy(dir_iter); return count;