diff options
-rw-r--r-- | include/libsysfs.h | 2 | ||||
-rw-r--r-- | lib/sysfs_utils.c | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/libsysfs.h b/include/libsysfs.h index 2cb9eb9..5a460eb 100644 --- a/include/libsysfs.h +++ b/include/libsysfs.h @@ -221,6 +221,8 @@ extern struct sysfs_attribute *sysfs_get_module_parm (struct sysfs_module *module, const char *parm); extern struct sysfs_attribute *sysfs_get_module_section (struct sysfs_module *module, const char *section); +extern struct sysfs_attribute *sysfs_open_module_attr(const char *module, + const char *attrib); /** * sort_list: sorter function to keep list elements sorted in alphabetical diff --git a/lib/sysfs_utils.c b/lib/sysfs_utils.c index 983cb2d..6397342 100644 --- a/lib/sysfs_utils.c +++ b/lib/sysfs_utils.c @@ -54,6 +54,9 @@ int sysfs_get_mnt_path(char *mnt_path, size_t len) static char sysfs_path[SYSFS_PATH_MAX] = ""; const char *sysfs_path_env; + if (len == 0 || mnt_path == NULL) + return -1; + /* evaluate only at the first call */ if (sysfs_path[0] == '\0') { /* possible overrride of real mount path */ |