mirror of
https://github.com/moparisthebest/pacman
synced 2024-10-31 15:45:03 -04:00
Fix mount dir length calculation
In the getmntinfo() section, the local variable mnt doesn't exist; this would have caused a compile error if I had tested the code on such a platform. Unify both codepaths to just run strlen() on the already copied mount path instead. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
06cbb516c3
commit
0eac60cd9d
@ -83,7 +83,7 @@ static alpm_list_t *mount_point_list(void)
|
|||||||
|
|
||||||
MALLOC(mp, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
MALLOC(mp, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
mp->mount_dir = strdup(mnt->mnt_dir);
|
mp->mount_dir = strdup(mnt->mnt_dir);
|
||||||
mp->mount_dir_len = strlen(mnt->mnt_dir);
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
memcpy(&(mp->fsp), &fsp, sizeof(FSSTATSTYPE));
|
memcpy(&(mp->fsp), &fsp, sizeof(FSSTATSTYPE));
|
||||||
|
|
||||||
mp->blocks_needed = 0l;
|
mp->blocks_needed = 0l;
|
||||||
@ -101,13 +101,13 @@ static alpm_list_t *mount_point_list(void)
|
|||||||
entries = getmntinfo(&fsp, MNT_NOWAIT);
|
entries = getmntinfo(&fsp, MNT_NOWAIT);
|
||||||
|
|
||||||
if (entries < 0) {
|
if (entries < 0) {
|
||||||
return NULL;
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; entries-- > 0; fsp++) {
|
for(; entries-- > 0; fsp++) {
|
||||||
MALLOC(mp, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
MALLOC(mp, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
mp->mount_dir = strdup(fsp->f_mntonname);
|
mp->mount_dir = strdup(fsp->f_mntonname);
|
||||||
mp->mount_dir_len = strlen(mnt->mnt_dir);
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
|
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
|
||||||
|
|
||||||
mp->blocks_needed = 0l;
|
mp->blocks_needed = 0l;
|
||||||
|
Loading…
Reference in New Issue
Block a user