summaryrefslogtreecommitdiff
path: root/src/binfmt
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-05-03 18:18:09 +0200
committerLennart Poettering <lennart@poettering.net>2021-05-07 16:43:26 +0200
commit2708160ccda8727de80442cbf634489a360ca001 (patch)
tree2c9e2d90210a41fdcf77c3ca4b01173af306768c /src/binfmt
parentac2c088939de5aba5a06bee00dbc6c89a2809534 (diff)
downloadsystemd-2708160ccda8727de80442cbf634489a360ca001.tar.gz
fileio: optionally, return discovered path of file in search_and_fopen()
Diffstat (limited to 'src/binfmt')
-rw-r--r--src/binfmt/binfmt.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
index f6b72e0bae..29530bb691 100644
--- a/src/binfmt/binfmt.c
+++ b/src/binfmt/binfmt.c
@@ -65,11 +65,12 @@ static int apply_rule(const char *rule) {
static int apply_file(const char *path, bool ignore_enoent) {
_cleanup_fclose_ FILE *f = NULL;
+ _cleanup_free_ char *pp = NULL;
int r;
assert(path);
- r = search_and_fopen(path, "re", NULL, (const char**) CONF_PATHS_STRV("binfmt.d"), &f);
+ r = search_and_fopen(path, "re", NULL, (const char**) CONF_PATHS_STRV("binfmt.d"), &f, &pp);
if (r < 0) {
if (ignore_enoent && r == -ENOENT)
return 0;
@@ -77,7 +78,7 @@ static int apply_file(const char *path, bool ignore_enoent) {
return log_error_errno(r, "Failed to open file '%s': %m", path);
}
- log_debug("apply: %s", path);
+ log_debug("apply: %s", pp);
for (;;) {
_cleanup_free_ char *line = NULL;
char *p;
@@ -85,7 +86,7 @@ static int apply_file(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;