fs: Store mtab path in allocated string
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
2c2fb6a947
commit
ec1d29e61c
3
fs/fs.c
3
fs/fs.c
|
@ -809,7 +809,7 @@ int mount(const char *device, const char *fsname, const char *_path)
|
||||||
|
|
||||||
/* add mtab entry */
|
/* add mtab entry */
|
||||||
entry = &fsdev->mtab;
|
entry = &fsdev->mtab;
|
||||||
safe_strncpy(entry->path, path, PATH_MAX);
|
entry->path = xstrdup(path);
|
||||||
entry->dev = dev;
|
entry->dev = dev;
|
||||||
entry->parent_device = parent_device;
|
entry->parent_device = parent_device;
|
||||||
|
|
||||||
|
@ -860,6 +860,7 @@ int umount(const char *pathname)
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(entry->path);
|
||||||
list_del(&entry->list);
|
list_del(&entry->list);
|
||||||
if (entry == mtab_root)
|
if (entry == mtab_root)
|
||||||
mtab_root = NULL;
|
mtab_root = NULL;
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct fs_driver_d {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mtab_entry {
|
struct mtab_entry {
|
||||||
char path[PATH_MAX];
|
char *path;
|
||||||
struct device_d *dev;
|
struct device_d *dev;
|
||||||
struct device_d *parent_device;
|
struct device_d *parent_device;
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
|
|
Loading…
Reference in New Issue