From ca2e894bdbd06b43800b57074be0e499a3539b0d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 10 Jun 2012 19:21:50 +0200 Subject: [PATCH 1/1] tmpfiles: print error if basename lookup fails; document it in manpage --- man/systemd-tmpfiles.xml | 10 +++++++--- src/tmpfiles/tmpfiles.c | 10 +++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/man/systemd-tmpfiles.xml b/man/systemd-tmpfiles.xml index 4ac7224ab..623b42056 100644 --- a/man/systemd-tmpfiles.xml +++ b/man/systemd-tmpfiles.xml @@ -67,9 +67,13 @@ If invoked with no arguments, it applies all directives from all configuration files. If one or - more absolute file names are passed on the command - line only the directives in these files are - applied. + more file names are passed on the command line, only + the directives in these files are applied. If only + the basename of a configuration file is specified, + all configuration directories as specified in + tmpfiles.d + 5 + are searched for a matching file. diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index bec73ff6c..12ec0b2f1 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -1281,6 +1281,7 @@ static char *resolve_fragment(const char *fragment, const char **search_paths) { free(resolved_path); } + errno = ENOENT; return NULL; } @@ -1316,7 +1317,14 @@ int main(int argc, char *argv[]) { int j; for (j = optind; j < argc; j++) { - char *fragment = resolve_fragment(argv[j], conf_file_dirs); + char *fragment; + + fragment = resolve_fragment(argv[j], conf_file_dirs); + if (!fragment) { + log_error("Failed to find any: %s file: %m", argv[j]); + r = EXIT_FAILURE; + goto finish; + } if (read_config_file(fragment, false) < 0) r = EXIT_FAILURE; free(fragment); -- 2.30.2