31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
commit 32958b576e87ec517048a8e446a7a06b703a36d2
|
|
Author: Kamalesh Babulal <kamalesh@linux.ibm.com>
|
|
Date: Mon May 31 15:46:59 2021 +0530
|
|
|
|
sysfstreecollector: check path before return in getDevTreePath()
|
|
|
|
devspec holds the device-path for the device in the /proc/device-tree,
|
|
some cases this file may also hold "(null)" string as value. Check for
|
|
device-tree path before returning from getDevTreePath() and return
|
|
empty string like in the error cases for "(null)" case.
|
|
|
|
Signed-off-by: Kamalesh Babulal <kamalesh@linux.ibm.com>
|
|
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
|
|
|
|
diff --git a/src/internal/sys_interface/sysfstreecollector.cpp b/src/internal/sys_interface/sysfstreecollector.cpp
|
|
index 9e808de..7e7e13c 100644
|
|
--- a/src/internal/sys_interface/sysfstreecollector.cpp
|
|
+++ b/src/internal/sys_interface/sysfstreecollector.cpp
|
|
@@ -985,7 +985,10 @@ esc_subsystem_info:
|
|
|
|
fclose(fi);
|
|
// cleanup
|
|
- return string(buf2);
|
|
+ if (strcmp(buf2, "(null)"))
|
|
+ return string(buf2);
|
|
+
|
|
+ return string("");
|
|
}
|
|
|
|
/* Collects devices on system, then returns how many were found.
|