chiark / gitweb /
Remove dead code and unexport some calls
[elogind.git] / src / shared / conf-parser.c
index 2303d9a50b7bb348bba6f2631f0708d40a02022b..efd2147e798acc86ddb8ce65e1015d77f758e465 100644 (file)
@@ -24,6 +24,7 @@
 #include <errno.h>
 #include <assert.h>
 #include <stdlib.h>
+#include <netinet/ether.h>
 
 #include "conf-parser.h"
 #include "util.h"
@@ -516,37 +517,6 @@ int config_parse_bool(const char* unit,
         return 0;
 }
 
-int config_parse_tristate(const char *unit,
-                          const char *filename,
-                          unsigned line,
-                          const char *section,
-                          const char *lvalue,
-                          int ltype,
-                          const char *rvalue,
-                          void *data,
-                          void *userdata) {
-
-        int k;
-        int *b = data;
-
-        assert(filename);
-        assert(lvalue);
-        assert(rvalue);
-        assert(data);
-
-        /* Tristates are like booleans, but can also take the 'default' value, i.e. "-1" */
-
-        k = parse_boolean(rvalue);
-        if (k < 0) {
-                log_syntax(unit, LOG_ERR, filename, line, -k,
-                           "Failed to parse boolean value, ignoring: %s", rvalue);
-                return 0;
-        }
-
-        *b = !!k;
-        return 0;
-}
-
 int config_parse_string(const char *unit,
                         const char *filename,
                         unsigned line,
@@ -599,6 +569,7 @@ int config_parse_path(const char *unit,
 
         char **s = data;
         char *n;
+        int offset;
 
         assert(filename);
         assert(lvalue);
@@ -611,7 +582,9 @@ int config_parse_path(const char *unit,
                 return 0;
         }
 
-        if (!path_is_absolute(rvalue)) {
+        offset = rvalue[0] == '-' && (streq(lvalue, "InaccessibleDirectories") ||
+                                      streq(lvalue, "ReadOnlyDirectories"));
+        if (!path_is_absolute(rvalue + offset)) {
                 log_syntax(unit, LOG_ERR, filename, line, EINVAL,
                            "Not an absolute path, ignoring: %s", rvalue);
                 return 0;
@@ -713,6 +686,7 @@ int config_parse_path_strv(const char *unit,
 
         FOREACH_WORD_QUOTED(w, l, rvalue, state) {
                 _cleanup_free_ char *n;
+                int offset;
 
                 n = strndup(w, l);
                 if (!n)
@@ -724,7 +698,9 @@ int config_parse_path_strv(const char *unit,
                         continue;
                 }
 
-                if (!path_is_absolute(n)) {
+                offset = n[0] == '-' && (streq(lvalue, "InaccessibleDirectories") ||
+                                         streq(lvalue, "ReadOnlyDirectories"));
+                if (!path_is_absolute(n + offset)) {
                         log_syntax(unit, LOG_ERR, filename, line, EINVAL,
                                    "Not an absolute path, ignoring: %s", rvalue);
                         continue;