chiark / gitweb /
util: when reading a line from a file have space for at least 2k chars
[elogind.git] / util.c
diff --git a/util.c b/util.c
index 939b2b06e9ddb2da442f688e30a596ed449b6837..69a26a2d08ddecb8aef5a3fa955a4a06377ff820 100644 (file)
--- a/util.c
+++ b/util.c
@@ -412,7 +412,7 @@ finish:
 int read_one_line_file(const char *fn, char **line) {
         FILE *f;
         int r;
-        char t[64], *c;
+        char t[2048], *c;
 
         assert(fn);
         assert(line);
@@ -1193,6 +1193,17 @@ finish:
         return r;
 }
 
+bool chars_intersect(const char *a, const char *b) {
+        const char *p;
+
+        /* Returns true if any of the chars in a are in b. */
+        for (p = a; *p; p++)
+                if (strchr(b, *p))
+                        return true;
+
+        return false;
+}
+
 static const char *const ioprio_class_table[] = {
         [IOPRIO_CLASS_NONE] = "none",
         [IOPRIO_CLASS_RT] = "realtime",