Signed-off-by: Chengwei Yang <[email protected]>
---
 libkmod/libkmod.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libkmod/libkmod.c b/libkmod/libkmod.c
index 98cf15e..fd91469 100644
--- a/libkmod/libkmod.c
+++ b/libkmod/libkmod.c
@@ -882,9 +882,14 @@ KMOD_EXPORT int kmod_dump_index(struct kmod_ctx *ctx, enum 
kmod_index type,
                return -ENOENT;
 
        if (ctx->indexes[type] != NULL) {
-               DBG(ctx, "use mmaped index '%s'\n", index_files[type].fn);
-               index_mm_dump(ctx->indexes[type], fd,
+               char path[PATH_MAX];
+               snprintf(path, sizeof(path), "%s/%s.bin", ctx->dirname,
+                                               index_files[type].fn);
+               if (!is_cache_invalid(path, ctx->indexes_stamp[type])) {
+                       DBG(ctx, "use mmaped index '%s'\n", 
index_files[type].fn);
+                       index_mm_dump(ctx->indexes[type], fd,
                                                index_files[type].prefix);
+               }
        } else {
                char fn[PATH_MAX];
                struct index_file *idx;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to