chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-journal: check if the pointers passed are the same
[elogind.git]
/
src
/
journal
/
sd-journal.c
diff --git
a/src/journal/sd-journal.c
b/src/journal/sd-journal.c
index bc9e41e0471518a37ef5603896659cb06ef6a029..779af62b518bff9eb6831a1c64233dcb2b00c01d 100644
(file)
--- a/
src/journal/sd-journal.c
+++ b/
src/journal/sd-journal.c
@@
-109,6
+109,9
@@
static void set_location(sd_journal *j, LocationType type, JournalFile *f, Objec
init_location(&j->current_location, type, f, o);
init_location(&j->current_location, type, f, o);
+ if (j->current_file)
+ j->current_file->current_offset = 0;
+
j->current_file = f;
j->current_field = 0;
j->current_file = f;
j->current_field = 0;
@@
-412,7
+415,7
@@
_public_ void sd_journal_flush_matches(sd_journal *j) {
}
static int compare_entry_order(JournalFile *af, Object *_ao,
}
static int compare_entry_order(JournalFile *af, Object *_ao,
- JournalFile *bf, uint64_t bp) {
+
JournalFile *bf, uint64_t bp) {
uint64_t a, b;
Object *ao, *bo;
uint64_t a, b;
Object *ao, *bo;
@@
-495,7
+498,7
@@
static int compare_entry_order(JournalFile *af, Object *_ao,
return 0;
}
return 0;
}
-static int compare_with_location(JournalFile *af, Object *ao, Location *l) {
+
_pure_
static int compare_with_location(JournalFile *af, Object *ao, Location *l) {
uint64_t a;
assert(af);
uint64_t a;
assert(af);
@@
-1256,7
+1259,7
@@
static void check_network(sd_journal *j, int fd) {
}
static int add_file(sd_journal *j, const char *prefix, const char *filename) {
}
static int add_file(sd_journal *j, const char *prefix, const char *filename) {
-
char _cleanup_free_
*path = NULL;
+
_cleanup_free_ char
*path = NULL;
int r;
JournalFile *f;
int r;
JournalFile *f;
@@
-1347,9
+1350,9
@@
static int remove_file(sd_journal *j, const char *prefix, const char *filename)
}
static int add_directory(sd_journal *j, const char *prefix, const char *dirname) {
}
static int add_directory(sd_journal *j, const char *prefix, const char *dirname) {
-
char _cleanup_free_
*path = NULL;
+
_cleanup_free_ char
*path = NULL;
int r;
int r;
-
DIR _cleanup_closedir_
*d = NULL;
+
_cleanup_closedir_ DIR
*d = NULL;
sd_id128_t id, mid;
Directory *m;
sd_id128_t id, mid;
Directory *m;
@@
-1437,7
+1440,7
@@
static int add_directory(sd_journal *j, const char *prefix, const char *dirname)
}
static int add_root_directory(sd_journal *j, const char *p) {
}
static int add_root_directory(sd_journal *j, const char *p) {
-
DIR _cleanup_closedir_
*d = NULL;
+
_cleanup_closedir_ DIR
*d = NULL;
Directory *m;
int r;
Directory *m;
int r;
@@
-2214,6
+2217,8
@@
_public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from,
return -EINVAL;
if (!from && !to)
return -EINVAL;
return -EINVAL;
if (!from && !to)
return -EINVAL;
+ if (from == to)
+ return -EINVAL;
HASHMAP_FOREACH(f, j->files, i) {
usec_t fr, t;
HASHMAP_FOREACH(f, j->files, i) {
usec_t fr, t;
@@
-2253,6
+2258,8
@@
_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot
return -EINVAL;
if (!from && !to)
return -EINVAL;
return -EINVAL;
if (!from && !to)
return -EINVAL;
+ if (from == to)
+ return -EINVAL;
HASHMAP_FOREACH(f, j->files, i) {
usec_t fr, t;
HASHMAP_FOREACH(f, j->files, i) {
usec_t fr, t;