- /*
- * All "devices" have the "detach_state" attribute - validate here
- */
- safestrcat(ppath, "/detach_state");
- if (sysfs_path_is_file(ppath)) {
+ /* Make sure we're not at the top of the device tree */
+ sysfs_get_mnt_path(dpath, SYSFS_PATH_MAX);
+ safestrcat(dpath, "/" SYSFS_DEVICES_NAME);
+ if (strcmp(dpath, ppath) == 0) {