chiark / gitweb /
journal: add basic object definition for signatures
[elogind.git] / src / journal / sd-journal.c
index 9d381e044cf77b636d6b2bccaea3251c51637a90..9f46f5c6aa4d85e3fa3f02ec2e7cc6a0b28455cb 100644 (file)
@@ -30,6 +30,7 @@
 #include "journal-file.h"
 #include "hashmap.h"
 #include "list.h"
+#include "path-util.h"
 #include "lookup3.h"
 #include "compress.h"
 #include "journal-internal.h"
@@ -114,8 +115,17 @@ _public_ int sd_journal_add_match(sd_journal *j, const void *data, size_t size)
                 return -EINVAL;
         if (!data)
                 return -EINVAL;
-        if (size <= 0)
+        if (size <= 1)
                 return -EINVAL;
+        if (!memchr(data, '=', size))
+                return -EINVAL;
+        if (*(char*) data == '=')
+                return -EINVAL;
+
+        /* FIXME: iterating with multiple matches is currently
+         * broken */
+        if (j->matches)
+                return -ENOTSUP;
 
         le_hash = htole64(hash64(data, size));
 
@@ -765,7 +775,7 @@ _public_ int sd_journal_get_cursor(sd_journal *j, char **cursor) {
                      bid, (unsigned long long) le64toh(o->entry.monotonic),
                      (unsigned long long) le64toh(o->entry.realtime),
                      (unsigned long long) le64toh(o->entry.xor_hash),
-                     file_name_from_path(j->current_file->path)) < 0)
+                     path_get_file_name(j->current_file->path)) < 0)
                 return -ENOMEM;
 
         return 1;