chiark / gitweb /
journalctl: rework short output mode to rebuild full syslog message
[elogind.git] / src / conf-parser.c
index a99c70596b0a52eb6aeeb7bc78d5af6691a5f232..3ccd1c067a20c13b0aa085fa8d9a4093af3d6a63 100644 (file)
@@ -88,7 +88,8 @@ int config_item_perf_lookup(
         else {
                 char *key;
 
-                if (asprintf(&key, "%s.%s", section, lvalue) < 0)
+                key = join(section, ".", lvalue, NULL);
+                if (!key)
                         return -ENOMEM;
 
                 p = lookup(key, strlen(key));
@@ -313,7 +314,7 @@ int config_parse(
                                 continuation = c;
                         else {
                                 continuation = strdup(l);
-                                if (!c) {
+                                if (!continuation) {
                                         r = -ENOMEM;
                                         goto finish;
                                 }
@@ -751,3 +752,30 @@ int config_parse_mode(
         *m = (mode_t) l;
         return 0;
 }
+
+int config_parse_bytes(
+                const char *filename,
+                unsigned line,
+                const char *section,
+                const char *lvalue,
+                int ltype,
+                const char *rvalue,
+                void *data,
+                void *userdata) {
+
+        off_t *bytes = data;
+
+        assert(filename);
+        assert(lvalue);
+        assert(rvalue);
+        assert(data);
+
+        assert_cc(sizeof(off_t) == sizeof(uint64_t));
+
+        if (parse_bytes(rvalue, bytes) < 0) {
+                log_error("[%s:%u] Failed to parse bytes value, ignoring: %s", filename, line, rvalue);
+                return 0;
+        }
+
+        return 0;
+}