diff options
author | Artur Wojcik <artur.wojcik@intel.com> | 2009-12-10 20:03:40 +0100 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-12-10 20:03:40 +0100 |
commit | 33a6535d00eff4475a1557f3d9124e362a74ad28 (patch) | |
tree | 13d1c1d6262f2578e1d9d381ca9361d41c79f475 /sysfs.c | |
parent | Fix for resource leak on error path. (diff) | |
download | mdadm-33a6535d00eff4475a1557f3d9124e362a74ad28.tar.xz mdadm-33a6535d00eff4475a1557f3d9124e362a74ad28.zip |
Fix required to enable RAID arrays on SAS disks.
The patch increases the capacity of buffers used to store
sysfs path names. Originally the buffers were too small to
hold the canonical representation of sysfs path (in case
of a SAS device, especially a device installed behind an
expander).
Signed-off-by: Artur Wojcik <artur.wojcik@intel.com>
Reviewed-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'sysfs.c')
-rw-r--r-- | sysfs.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -100,13 +100,8 @@ void sysfs_init(struct mdinfo *mdi, int fd, int devnum) struct mdinfo *sysfs_read(int fd, int devnum, unsigned long options) { - /* Longest possible name in sysfs, mounted at /sys, is - * /sys/block/md_dXXX/md/dev-XXXXX/block/dev - * /sys/block/md_dXXX/md/metadata_version - * which is about 41 characters. 50 should do for now - */ - char fname[50]; - char buf[1024]; + char fname[PATH_MAX]; + char buf[PATH_MAX]; char *base; char *dbase; struct mdinfo *sra; @@ -574,8 +569,8 @@ int sysfs_set_array(struct mdinfo *info, int vers) int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int in_sync) { - char dv[100]; - char nm[100]; + char dv[PATH_MAX]; + char nm[PATH_MAX]; char *dname; int rv; |