1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

filesystem: use PATH_MAX for linux paths

This commit is contained in:
Zdenek Kabelac 2023-02-12 19:23:12 +01:00
parent 615347da20
commit cf0dc9a13c

View File

@ -232,10 +232,10 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
FILE *fp; FILE *fp;
char proc_line[PATH_MAX]; char proc_line[PATH_MAX];
char proc_fstype[FSTYPE_MAX]; char proc_fstype[FSTYPE_MAX];
char proc_devpath[1024]; char proc_devpath[PATH_MAX];
char proc_mntpath[1024]; char proc_mntpath[PATH_MAX];
char lv_mapper_path[1024]; char lv_mapper_path[PATH_MAX];
char mntent_mount_dir[1024]; char mntent_mount_dir[PATH_MAX];
char *dm_name; char *dm_name;
struct stat st_lv; struct stat st_lv;
struct stat stme; struct stat stme;
@ -275,14 +275,14 @@ int fs_mount_state_is_misnamed(struct cmd_context *cmd, struct logical_volume *l
continue; continue;
if (stme.st_dev != st_lv.st_rdev) if (stme.st_dev != st_lv.st_rdev)
continue; continue;
strncpy(mntent_mount_dir, me->mnt_dir, PATH_MAX-1); dm_strncpy(mntent_mount_dir, me->mnt_dir, sizeof(mntent_mount_dir));
} }
endmntent(fme); endmntent(fme);
if (!(dm_name = dm_build_dm_name(cmd->mem, lv->vg->name, lv->name, NULL))) if (!(dm_name = dm_build_dm_name(cmd->mem, lv->vg->name, lv->name, NULL)))
return_0; return_0;
if ((dm_snprintf(lv_mapper_path, 1024, "%s/%s", dm_dir(), dm_name) < 0)) if ((dm_snprintf(lv_mapper_path, sizeof(lv_mapper_path), "%s/%s", dm_dir(), dm_name) < 0))
return_0; return_0;
if (!(fp = fopen("/proc/mounts", "r"))) if (!(fp = fopen("/proc/mounts", "r")))