summaryrefslogtreecommitdiff
path: root/libsysfs/sysfs_bus.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_bus.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_bus.c')
-rw-r--r--libsysfs/sysfs_bus.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c
index 3111154cbc..639acef4ee 100644
--- a/libsysfs/sysfs_bus.c
+++ b/libsysfs/sysfs_bus.c
@@ -112,7 +112,10 @@ static struct sysfs_directory *open_bus_dir(const unsigned char *name)
return NULL;
}
- strcat(buspath, SYSFS_BUS_DIR);
+ if (sysfs_trailing_slash(buspath) == 0)
+ strcat(buspath, "/");
+
+ strcat(buspath, SYSFS_BUS_NAME);
strcat(buspath, "/");
strcat(buspath, name);
busdir = sysfs_open_directory(buspath);
@@ -406,10 +409,13 @@ struct sysfs_device *sysfs_open_bus_device(unsigned char *busname,
return NULL;
}
- strcat(path, SYSFS_BUS_DIR);
+ if (sysfs_trailing_slash(path) == 0)
+ strcat(path, "/");
+ strcat(path, SYSFS_BUS_NAME);
strcat(path, "/");
strcat(path, busname);
- strcat(path, SYSFS_DEVICES_DIR);
+ strcat(path, "/");
+ strcat(path, SYSFS_DEVICES_NAME);
strcat(path, "/");
strcat(path, dev_id);
@@ -442,15 +448,17 @@ int sysfs_find_driver_bus(const unsigned char *driver, unsigned char *busname,
}
memset(subsys, 0, SYSFS_PATH_MAX);
- strcpy(subsys, SYSFS_BUS_DIR);
+ strcpy(subsys, SYSFS_BUS_NAME);
buslist = sysfs_open_subsystem_list(subsys);
if (buslist != NULL) {
dlist_for_each_data(buslist, bus, char) {
memset(subsys, 0, SYSFS_PATH_MAX);
- strcpy(subsys, SYSFS_BUS_DIR);
+ strcat(subsys, "/");
+ strcpy(subsys, SYSFS_BUS_NAME);
strcat(subsys, "/");
strcat(subsys, bus);
- strcat(subsys, SYSFS_DRIVERS_DIR);
+ strcat(subsys, "/");
+ strcat(subsys, SYSFS_DRIVERS_NAME);
drivers = sysfs_open_subsystem_list(subsys);
if (drivers != NULL) {
dlist_for_each_data(drivers, curdrv, char) {