next_field() may return NULL
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:
Родитель
2adc05904d
Коммит
fe6b72052d
|
@ -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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче