chiark / gitweb /
don't choke on invalid dropin file names
authorLennart Poettering <lennart@poettering.net>
Wed, 27 Jan 2010 03:55:19 +0000 (04:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 27 Jan 2010 03:55:19 +0000 (04:55 +0100)
load-dropin.c

index b975d83..a57bfc4 100644 (file)
@@ -5,6 +5,7 @@
 
 #include "unit.h"
 #include "load-dropin.h"
+#include "log.h"
 
 int unit_load_dropin(Unit *u) {
         Iterator i;
@@ -51,6 +52,12 @@ int unit_load_dropin(Unit *u) {
                                 return -ENOMEM;
                         }
 
+                        if (!unit_name_is_valid(de->d_name)) {
+                                log_info("Name of %s is not a valid unit name. Ignoring.", path);
+                                free(path);
+                                continue;
+                        }
+
                         r = manager_load_unit(u->meta.manager, path, &other);
                         free(path);