Although unlikely (as /proc/swaps is considered a system ABI), just be a bit more
cautious when handling its return value when looking for a swap file.
This commit is contained in:
Leandro Pereira 2021-07-13 12:50:45 -07:00
Родитель 2adc05904d
Коммит fe6b72052d
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -251,6 +251,11 @@ static struct swap_file *find_swap_file(size_t needed_size)
char *filename = buffer;
char *type = next_field(filename);
if (!type) {
log_info("Couldn't get the second field while parsing /proc/swaps");
break;
}
if (!strcmp(type, "file")) {
char *size = next_field(type);