lib/sysfs: make sysfs_next_subsystem() more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
56e78cb532
commit
32c9ce4baf
1 changed files with 2 additions and 0 deletions
|
@ -658,6 +658,8 @@ int sysfs_next_subsystem(struct sysfs_cxt *cxt __attribute__((unused)),
|
|||
if (!subsys || !devchain)
|
||||
return -EINVAL;
|
||||
|
||||
*subsys = NULL;
|
||||
|
||||
while ((sub = get_subsystem(devchain, subbuf, sizeof(subbuf)))) {
|
||||
*subsys = strdup(sub);
|
||||
if (!*subsys)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue