diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-05-03 18:18:09 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-05-07 16:43:26 +0200 |
commit | 2708160ccda8727de80442cbf634489a360ca001 (patch) | |
tree | 2c9e2d90210a41fdcf77c3ca4b01173af306768c /src/modules-load | |
parent | ac2c088939de5aba5a06bee00dbc6c89a2809534 (diff) | |
download | systemd-2708160ccda8727de80442cbf634489a360ca001.tar.gz |
fileio: optionally, return discovered path of file in search_and_fopen()
Diffstat (limited to 'src/modules-load')
-rw-r--r-- | src/modules-load/modules-load.c | 7 |
1 files changed, 4 insertions, 3 deletions
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; |