]> git.alsa-project.org Git - alsa-lib.git/commitdiff
conf: Use ino64_t to save and compare inode numbers
authorSimon McVittie <smcv@collabora.com>
Wed, 25 May 2022 11:33:42 +0000 (12:33 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 5 Jun 2022 08:24:26 +0000 (10:24 +0200)
On 32-bit platforms when not using the large-file-support ABI,
struct stat64 contains ino64_t which is 64-bit, while ino_t is only
32-bit.

snd_config_update_r() checks whether a file has been replaced by saving
the ino member of a struct stat64 and comparing it with a previously-saved
inode number. On 32-bit platforms, assigning the 64-bit member of struct
stat64 to a 32-bit member of struct finfo will truncate it modulo 1<<32,
which could conceivably result in libasound not reloading configuration
when it should (although the inode number space is large enough to make
this failure mode highly unlikely).

Fixes: https://github.com/alsa-project/alsa-lib/pull/231
Signed-off-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
include/local.h
src/conf.c

index 51fa4063afa74247d3e20b2b4538bbf6bdd84080..268a9ff1200e2c93d09a344b73af0dc916cd4c6e 100644 (file)
@@ -84,6 +84,7 @@
 #define scandir64 scandir
 #define versionsort64 versionsort
 #define alphasort64 alphasort
+#define ino64_t ino_t
 #endif
 
 #define _snd_config_iterator list_head
index 3d2b4a5bc1841a0b0b9d10984e4d3ab6f23e2019..a996e5f9f9be018d75604793a726279e23e9e8d2 100644 (file)
@@ -3921,7 +3921,7 @@ snd_config_t *snd_config = NULL;
 struct finfo {
        char *name;
        dev_t dev;
-       ino_t ino;
+       ino64_t ino;
        time_t mtime;
 };