chiark / gitweb /
first attempt in implementinging execution logic
[elogind.git] / load-fragment.c
index 05a7114b4493f05466956220d785d0cadbf8098b..a2c36368da8ddbaa3f391548596b7e787fc37d30 100644 (file)
@@ -8,6 +8,7 @@
 #include "strv.h"
 #include "conf-parser.h"
 #include "load-fragment.h"
+#include "log.h"
 
 static int config_parse_deps(
                 const char *filename,
@@ -88,12 +89,12 @@ static int config_parse_names(
 
                         if (other != name) {
 
-                                if (other->meta.state != NAME_STUB) {
+                                if (other->meta.load_state != NAME_STUB) {
                                         free(t);
                                         return -EEXIST;
                                 }
 
-                                if ((r = name_merge(name, other) < 0)) {
+                                if ((r = name_merge(name, other)) < 0) {
                                         free(t);
                                         return r;
                                 }
@@ -130,12 +131,19 @@ static int config_parse_listen(
                 void *data,
                 void *userdata) {
 
+        int r;
+
         assert(filename);
         assert(lvalue);
         assert(rvalue);
         assert(data);
 
-        return address_parse(data, rvalue);
+        if ((r = address_parse(data, rvalue)) < 0) {
+                log_error("[%s:%u] Failed to parse address value: %s", filename, line, rvalue);
+                return r;
+        }
+
+        return 0;
 }
 
 static int config_parse_type(
@@ -158,15 +166,17 @@ static int config_parse_type(
                 *type = SOCK_STREAM;
         else if (streq(rvalue, "dgram"))
                 *type = SOCK_DGRAM;
-        else
+        else {
+                log_error("[%s:%u] Failed to parse socket type value: %s", filename, line, rvalue);
                 return -EINVAL;
+        }
 
         return 0;
 }
 
 int name_load_fragment(Name *n) {
 
-        const char *const section_table[_NAME_TYPE_MAX] = {
+        static const char* const section_table[_NAME_TYPE_MAX] = {
                 [NAME_SERVICE]   = "Service",
                 [NAME_TIMER]     = "Timer",
                 [NAME_SOCKET]    = "Socket",
@@ -201,7 +211,7 @@ int name_load_fragment(Name *n) {
         const char *sections[3];
 
         assert(n);
-        assert(n->meta.state == NAME_STUB);
+        assert(n->meta.load_state == NAME_STUB);
 
         sections[0] = "Meta";
         sections[1] = section_table[n->meta.type];