* Return 0 for success, with a NUL-terminated string in \param result.
* Return -ve value for error.
*/
-static int get_param(const char *param_path, char *result,
+int get_param(const char *param_path, char *result,
unsigned int result_size)
{
char file[PATH_MAX + 1], pattern[PATH_MAX + 1], buf[result_size];
snprintf(pattern, PATH_MAX, "/proc/{fs,sys}/{lnet,lustre}/%s",
param_path);
rc = first_match(pattern, file);
- if (rc)
+ if (rc != 0 || result == NULL)
return rc;
fp = fopen(file, "r");