char name_norm[NAME_MAX];
char *namesep;
- if (ctx == NULL || name == NULL)
+ if (ctx == NULL || name == NULL || mod == NULL)
return -ENOENT;
alias_normalize(name, name_norm, &namelen);
char *abspath;
size_t namelen;
- if (ctx == NULL || path == NULL)
+ if (ctx == NULL || path == NULL || mod == NULL)
return -ENOENT;
abspath = path_make_absolute_cwd(path);
*/
KMOD_EXPORT const char *kmod_module_get_name(const struct kmod_module *mod)
{
+ if (mod == NULL)
+ return NULL;
+
return mod->name;
}
{
char *line;
+ if (mod == NULL)
+ return NULL;
+
DBG(mod->ctx, "name='%s' path='%s'\n", mod->name, mod->path);
if (mod->path != NULL)
char path[PATH_MAX], buf[32];
int fd, err, pathlen;
+ if (mod == NULL)
+ return -ENOENT;
+
pathlen = snprintf(path, sizeof(path),
"/sys/module/%s/initstate", mod->name);
fd = open(path, O_RDONLY);
long refcnt;
int fd, err;
+ if (mod == NULL)
+ return -ENOENT;
+
snprintf(path, sizeof(path), "/sys/module/%s/refcnt", mod->name);
fd = open(path, O_RDONLY);
if (fd < 0) {
if (mod == NULL)
return NULL;
+
snprintf(dname, sizeof(dname), "/sys/module/%s/holders", mod->name);
d = opendir(dname);