From 45b65fa4c1f647159e453ffc3abe0218621e22c2 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Thu, 28 Apr 2022 22:46:56 +0200 Subject: [PATCH] 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 Signed-off-by: Jaroslav Kysela --- src/conf.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/conf.c b/src/conf.c index e7f9e78c..3d2b4a5b 100644 --- a/src/conf.c +++ b/src/conf.c @@ -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; -- 2.47.1