summaryrefslogtreecommitdiff
path: root/libsysfs/sysfs_device.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_device.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_device.c')
-rw-r--r--libsysfs/sysfs_device.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c
index fbd046f229..323a43dac1 100644
--- a/libsysfs/sysfs_device.c
+++ b/libsysfs/sysfs_device.c
@@ -36,7 +36,9 @@ static int confirm_device_bus(struct sysfs_device *dev,
if (sysfs_get_mnt_path(devpath, SYSFS_PATH_MAX) != 0)
return -1;
- strcat(devpath, SYSFS_BUS_DIR);
+ if (sysfs_trailing_slash(devpath) == 0)
+ strcat(devpath, "/");
+ strcat(devpath, SYSFS_BUS_NAME);
strcat(devpath, "/");
strcat(devpath, busname);
strcat(devpath, SYSFS_DEVICES_DIR);
@@ -306,7 +308,10 @@ static struct sysfs_directory *open_root_device_dir(const unsigned char *name)
return NULL;
}
- strcat(rootpath, SYSFS_DEVICES_DIR);
+ if (sysfs_trailing_slash(rootpath) == 0)
+ strcat(rootpath, "/");
+
+ strcat(rootpath, SYSFS_DEVICES_NAME);
strcat(rootpath, "/");
strcat(rootpath, name);
rdir = sysfs_open_directory(rootpath);
@@ -435,7 +440,9 @@ static int get_device_absolute_path(const unsigned char *device,
dprintf ("Sysfs not supported on this system\n");
return -1;
}
- strcat(bus_path, SYSFS_BUS_DIR);
+ if (sysfs_trailing_slash(bus_path) == 0)
+ strcat(bus_path, "/");
+ strcat(bus_path, SYSFS_BUS_NAME);
strcat(bus_path, "/");
strcat(bus_path, bus);
strcat(bus_path, SYSFS_DEVICES_DIR);