chiark / gitweb /
systemctl: properly parse JobNew signals
[elogind.git] / src / modules-load.c
index 3e3ccb0c2f2f188b3939497b8d0b1db091b57aa1..3824b57de7649293e65793b5e0123a0bdade05d7 100644 (file)
@@ -43,7 +43,8 @@ static int scandir_filter(const struct dirent *d) {
                 return 0;
 
         if (d->d_type != DT_REG &&
-            d->d_type != DT_LNK)
+            d->d_type != DT_LNK &&
+            d->d_type != DT_UNKNOWN)
                 return 0;
 
         return endswith(d->d_name, ".conf");
@@ -98,17 +99,21 @@ int main(int argc, char *argv[]) {
                 }
 
                 f = fopen(fn, "re");
-                free(fn);
 
                 if (!f) {
-                        if (errno == ENOENT)
+                        if (errno == ENOENT) {
+                                free(fn);
                                 continue;
+                        }
 
                         log_error("Failed to open %s: %m", fn);
+                        free(fn);
                         r = EXIT_FAILURE;
                         continue;
                 }
 
+                free(fn);
+
                 for (;;) {
                         char line[LINE_MAX], *l, *t;