From edcd336477880368915245a4b7ddd1bca5940b30 Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Tue, 2 Dec 2003 00:48:01 -0800 Subject: [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. --- libsysfs/sysfs_bus.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'libsysfs/sysfs_bus.c') 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) { -- cgit v1.2.3-54-g00ecf