diff options
author | Sebastian Krzyszkowiak <dos@dosowisko.net> | 2022-04-28 22:46:56 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2022-05-20 09:54:32 +0200 |
commit | 45b65fa4c1f647159e453ffc3abe0218621e22c2 (patch) | |
tree | 03de256ad7c4255851421bda8a0ca6fd4cb7ddc6 | |
parent | 87034d6fc607528a9df5e1793d159e2f6904ebd8 (diff) | |
download | alsa-lib-45b65fa4c1f647159e453ffc3abe0218621e22c2.tar.gz |
conf: Use LFS calls when reading config files
Although at first glance it doesn't seem useful to support config
files larger than 2GB, LFS also influences inode size. Without this,
32-bit libasound may be unable to read config files on filesystems
with 64-bit inodes, such as Btrfs or NFS.
Fixes: https://github.com/alsa-project/alsa-lib/pull/223
Signed-off-by: Sebastian Krzyszkowiak <dos@dosowisko.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | src/conf.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -4064,7 +4064,7 @@ static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data) return err; } -static int config_filename_filter(const struct dirent *dirent) +static int config_filename_filter(const struct dirent64 *dirent) { size_t flen; @@ -4102,13 +4102,13 @@ static int config_file_open(snd_config_t *root, const char *filename) static int config_file_load(snd_config_t *root, const char *fn, int errors) { - struct stat st; - struct dirent **namelist; + struct stat64 st; + struct dirent64 **namelist; int err, n; if (!errors && access(fn, R_OK) < 0) return 1; - if (stat(fn, &st) < 0) { + if (stat64(fn, &st) < 0) { SNDERR("cannot stat file/directory %s", fn); return 1; } @@ -4116,12 +4116,12 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors) return config_file_open(root, fn); #ifndef DOC_HIDDEN #if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) && !defined(ANDROID) -#define SORTFUNC versionsort +#define SORTFUNC versionsort64 #else -#define SORTFUNC alphasort +#define SORTFUNC alphasort64 #endif #endif - n = scandir(fn, &namelist, config_filename_filter, SORTFUNC); + n = scandir64(fn, &namelist, config_filename_filter, SORTFUNC); if (n > 0) { int j; err = 0; @@ -4545,9 +4545,9 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons c++; } for (k = 0; k < local->count; ++k) { - struct stat st; + struct stat64 st; struct finfo *lf = &local->finfo[k]; - if (stat(lf->name, &st) >= 0) { + if (stat64(lf->name, &st) >= 0) { lf->dev = st.st_dev; lf->ino = st.st_ino; lf->mtime = st.st_mtime; |