Skip to content

Commit 04c486d

Browse files
committed
PhysicalDisk (SunOS): detects unknown type
1 parent 152f3cd commit 04c486d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/detection/physicaldisk/physicaldisk_sunos.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,13 @@ static int walkDevTree(di_node_t node, di_minor_t minor, struct FFWalkTreeBundle
7373
}
7474

7575
int64_t* nblocks;
76-
if (di_prop_lookup_int64(DDI_DEV_T_ANY, node, "device-nblocks", &nblocks) > 0 && di_prop_lookup_ints(DDI_DEV_T_ANY, node, "device-blksize", &value) > 0) {
77-
device->size = (uint64_t) ((uint64_t) *nblocks * (uint64_t) *value);
76+
if (di_prop_lookup_int64(DDI_DEV_T_ANY, node, "device-nblocks", &nblocks) > 0) {
77+
if (*nblocks == 0) {
78+
device->size = 0;
79+
device->type |= FF_PHYSICALDISK_TYPE_UNKNOWN;
80+
} else if (di_prop_lookup_ints(DDI_DEV_T_ANY, node, "device-blksize", &value) > 0) {
81+
device->size = (uint64_t) ((uint64_t) *nblocks * (uint64_t) *value);
82+
}
7883
}
7984
}
8085

0 commit comments

Comments
 (0)