- memset(classpath, 0, SYSFS_PATH_MAX);
- if ((sysfs_get_mnt_path(classpath, SYSFS_PATH_MAX)) != 0) {
- dprintf(stderr, "Sysfs not supported on this system\n");
- return NULL;
- }
-
- strcat(classpath, SYSFS_CLASS_DIR);
- strcat(classpath, "/");
- strcat(classpath, name);
- classdir = sysfs_open_directory(classpath);
- if (classdir == NULL) {
- errno = EINVAL;
- dprintf(stderr,"Class %s not supported on this system\n",
- name);
- return NULL;
- }
- if ((sysfs_read_directory(classdir)) != 0) {
- dprintf(stderr, "Error reading %s class dir %s\n", name,
- classpath);
- sysfs_close_directory(classdir);
- return NULL;
+ if (c == NULL)
+ safestrcpy(cdev->classname, SYSFS_UNKNOWN);
+ else {
+ if (*c == '/')
+ c++;
+ e = c;
+ while (e != NULL && *e != '/' && *e != '\0') {
+ e++;
+ count++;
+ }
+ strncpy(cdev->classname, c, count);