chiark / gitweb /
tmpfiles: print error if basename lookup fails; document it in manpage
authorKay Sievers <kay@vrfy.org>
Sun, 10 Jun 2012 17:21:50 +0000 (19:21 +0200)
committerKay Sievers <kay@vrfy.org>
Sun, 10 Jun 2012 17:21:50 +0000 (19:21 +0200)
man/systemd-tmpfiles.xml
src/tmpfiles/tmpfiles.c

index 4ac7224ab2a6f77b9edeaeec9177b5c59066656c..623b420560b1d898372aac041db4bfff2be18532 100644 (file)
 
                 <para>If invoked with no arguments, it applies all
                 directives from all configuration files. If one or
 
                 <para>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.</para>
+                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 <citerefentry>
+                        <refentrytitle>tmpfiles.d</refentrytitle>
+                        <manvolnum>5</manvolnum>
+                </citerefentry> are searched for a matching file.</para>
         </refsect1>
 
         <refsect1>
         </refsect1>
 
         <refsect1>
index bec73ff6cc041f284963fe8c6768c0d054dc6884..12ec0b2f1bec9c1982f7e4f36f4f76d817d0590d 100644 (file)
@@ -1281,6 +1281,7 @@ static char *resolve_fragment(const char *fragment, const char **search_paths) {
                 free(resolved_path);
         }
 
                 free(resolved_path);
         }
 
+        errno = ENOENT;
         return NULL;
 }
 
         return NULL;
 }
 
@@ -1316,7 +1317,14 @@ int main(int argc, char *argv[]) {
                 int j;
 
                 for (j = optind; j < argc; j++) {
                 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);
                         if (read_config_file(fragment, false) < 0)
                                 r = EXIT_FAILURE;
                         free(fragment);