From 2708160ccda8727de80442cbf634489a360ca001 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 3 May 2021 18:18:09 +0200 Subject: fileio: optionally, return discovered path of file in search_and_fopen() --- src/modules-load/modules-load.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/modules-load') diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c index 9cfd292011..b57d806fab 100644 --- a/src/modules-load/modules-load.c +++ b/src/modules-load/modules-load.c @@ -62,12 +62,13 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent) { _cleanup_fclose_ FILE *f = NULL; + _cleanup_free_ char *pp = NULL; int r; assert(ctx); assert(path); - r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f); + r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f, &pp); if (r < 0) { if (ignore_enoent && r == -ENOENT) return 0; @@ -75,7 +76,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent return log_error_errno(r, "Failed to open %s: %m", path); } - log_debug("apply: %s", path); + log_debug("apply: %s", pp); for (;;) { _cleanup_free_ char *line = NULL; char *l; @@ -83,7 +84,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent k = read_line(f, LONG_LINE_MAX, &line); if (k < 0) - return log_error_errno(k, "Failed to read file '%s': %m", path); + return log_error_errno(k, "Failed to read file '%s': %m", pp); if (k == 0) break; -- cgit v1.2.1