summaryrefslogtreecommitdiff
path: root/libsysfs/sysfs_class.c
diff options
context:
space:
mode:
authordsteklof@us.ibm.com <dsteklof@us.ibm.com>2003-12-02 00:48:01 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:04 -0700
commitedcd336477880368915245a4b7ddd1bca5940b30 (patch)
tree7fbc2147d115ec6dc1050e41a2647bce2c7e957c /libsysfs/sysfs_class.c
parentbc1530c65c282e27eb60de797291ca45c2d8cda2 (diff)
[PATCH] another patch for path problem
The quick patch I sent you yesterday fixes it in one location, but there are other points in the library that calls sysfs_get_mnt_path. We need to address all the areas in the library where paths are used. The following patch is a band-aid until we can get a proper path management in the library.
Diffstat (limited to 'libsysfs/sysfs_class.c')
-rw-r--r--libsysfs/sysfs_class.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c
index a0273565d5..54f22eee24 100644
--- a/libsysfs/sysfs_class.c
+++ b/libsysfs/sysfs_class.c
@@ -116,14 +116,16 @@ static struct sysfs_directory *open_class_dir(const unsigned char *name)
return NULL;
}
+ if (sysfs_trailing_slash(classpath) == 0)
+ strcat(classpath, "/");
/*
* We shall now treat "block" also as a class. Hence, check here
* if "name" is "block" and proceed accordingly
*/
if (strcmp(name, SYSFS_BLOCK_NAME) == 0) {
- strcat(classpath, SYSFS_BLOCK_DIR);
+ strcat(classpath, SYSFS_BLOCK_NAME);
} else {
- strcat(classpath, SYSFS_CLASS_DIR);
+ strcat(classpath, SYSFS_CLASS_NAME);
strcat(classpath, "/");
strcat(classpath, name);
}
@@ -365,10 +367,13 @@ static int get_classdev_path(const unsigned char *classname,
dprintf("Error getting sysfs mount path\n");
return -1;
}
+ if (sysfs_trailing_slash(path) == 0)
+ strcat(path, "/");
+
if (strcmp(classname, SYSFS_BLOCK_NAME) == 0) {
- strcat(path, SYSFS_BLOCK_DIR);
+ strcat(path, SYSFS_BLOCK_NAME);
} else {
- strcat(path, SYSFS_CLASS_DIR);
+ strcat(path, SYSFS_CLASS_NAME);
strcat(path, "/");
strcat(path, classname);
}