Don't race in FreeBSD devstat collector

Querying the number of devices separately from the device list itself is
racy. Devices may be added or removed between the two calls; and removed
devices would lead to a segfault.
This commit is contained in:
Dominik Honnef 2016-12-31 06:52:44 +01:00
commit ea55d0f5cb
3 changed files with 71 additions and 72 deletions

View file

@ -38,4 +38,4 @@ typedef struct {
int _get_ndevs();
Stats _get_stats(int i);
int _get_stats(Stats **stats);