Evan Monroig
2019-07-23 5a9b03f6d35eac006fddc0908628cb1e9020f488
Improve fallbacks if no disks or no adapters

* Fallback to `generate_ethernet_pc_id` if there are no disks.
* Fallback to `generate_disk_pc_id` if there are no adapters.

See details in #25

Closes: #25
1个文件已修改
4 ■■■■ 已修改文件
src/library/pc-identifiers.c 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/library/pc-identifiers.c
@@ -39,11 +39,11 @@
    if (identifiers == NULL || *num_identifiers == 0) {
        result_adapterInfos = getAdapterInfos(NULL, &adapter_num);
        if (result_adapterInfos != FUNC_RET_OK) {
        if ((result_adapterInfos != FUNC_RET_OK) || (adapter_num == 0)) {
            return generate_disk_pc_id(identifiers, num_identifiers, false);
        }
        result_diskinfos = getDiskInfos(NULL, &disk_num);
        if (result_diskinfos != FUNC_RET_OK) {
        if ((result_diskinfos != FUNC_RET_OK) || (disk_num == 0)) {
            return generate_ethernet_pc_id(identifiers, num_identifiers, true);
        }
        *num_identifiers = disk_num * adapter_num;