dissect: tighten block device checks a bit
authorLennart Poettering <lennart@poettering.net>
Thu, 5 Apr 2018 11:03:37 +0000 (13:03 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 5 Apr 2018 11:03:37 +0000 (13:03 +0200)
commitaae22eb3a32d5dff8dc8e1a05edd0fa639ec40b8
treefb72a952e4b3bd6498b23c585771457fcd9554ef
parent6064de2de8734401669b787b68ebbf858d452cec
dissect: tighten block device checks a bit

This extends on #8609, and makes two changes:

1. We'll now explicitly check that the child devices of a block device
   we are interested in (i.e. the partitions) are block devices themselves.
   On newer kernels the mmc rpmb stuff is actually exposed as char rather
   than block device as before, and they probably should have been that in
   the first place. By adding this check we'll hence filter out these weird
   devices through a second rule too, that hopefully makes things a bit
   more future-proof, should more devices like this be added eventually,
   or other subsystems do a similar thing.

2. When counting partitions we'll now also check the devnum of the
   device being non-null, which we already do when matching up the devices
   in the second iteration. This should make things more robust, and
   prevent other kinds of miscounting, which after all was the main
   issue #8609 fixed.
src/shared/dissect-image.c