chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
journald: Fix off-by-one error in "Missed X kernel messages" warning
[elogind.git]
/
src
/
journal
/
sd-journal.c
diff --git
a/src/journal/sd-journal.c
b/src/journal/sd-journal.c
index f674abf9d73c6daed746b4a13ee26e01eaed4b6d..b9ec90230d74d0c9b7413594920ef328cfed7bb9 100644
(file)
--- a/
src/journal/sd-journal.c
+++ b/
src/journal/sd-journal.c
@@
-997,7
+997,7
@@
_public_ int sd_journal_get_cursor(sd_journal *j, char **cursor) {
}
_public_ int sd_journal_seek_cursor(sd_journal *j, const char *cursor) {
}
_public_ int sd_journal_seek_cursor(sd_journal *j, const char *cursor) {
- c
har *w
, *state;
+ c
onst char *word
, *state;
size_t l;
unsigned long long seqnum, monotonic, realtime, xor_hash;
bool
size_t l;
unsigned long long seqnum, monotonic, realtime, xor_hash;
bool
@@
-1013,18
+1013,18
@@
_public_ int sd_journal_seek_cursor(sd_journal *j, const char *cursor) {
assert_return(!journal_pid_changed(j), -ECHILD);
assert_return(!isempty(cursor), -EINVAL);
assert_return(!journal_pid_changed(j), -ECHILD);
assert_return(!isempty(cursor), -EINVAL);
- FOREACH_WORD_SEPARATOR(w, l, cursor, ";", state) {
+ FOREACH_WORD_SEPARATOR(w
ord
, l, cursor, ";", state) {
char *item;
int k = 0;
char *item;
int k = 0;
- if (l < 2 || w[1] != '=')
+ if (l < 2 || w
ord
[1] != '=')
return -EINVAL;
return -EINVAL;
- item = strndup(w, l);
+ item = strndup(w
ord
, l);
if (!item)
return -ENOMEM;
if (!item)
return -ENOMEM;
- switch (w[0]) {
+ switch (w
ord
[0]) {
case 's':
seqnum_id_set = true;
case 's':
seqnum_id_set = true;
@@
-1103,7
+1103,7
@@
_public_ int sd_journal_seek_cursor(sd_journal *j, const char *cursor) {
_public_ int sd_journal_test_cursor(sd_journal *j, const char *cursor) {
int r;
_public_ int sd_journal_test_cursor(sd_journal *j, const char *cursor) {
int r;
- c
har *w
, *state;
+ c
onst char *word
, *state;
size_t l;
Object *o;
size_t l;
Object *o;
@@
-1118,20
+1118,20
@@
_public_ int sd_journal_test_cursor(sd_journal *j, const char *cursor) {
if (r < 0)
return r;
if (r < 0)
return r;
- FOREACH_WORD_SEPARATOR(w, l, cursor, ";", state) {
+ FOREACH_WORD_SEPARATOR(w
ord
, l, cursor, ";", state) {
_cleanup_free_ char *item = NULL;
sd_id128_t id;
unsigned long long ll;
int k = 0;
_cleanup_free_ char *item = NULL;
sd_id128_t id;
unsigned long long ll;
int k = 0;
- if (l < 2 || w[1] != '=')
+ if (l < 2 || w
ord
[1] != '=')
return -EINVAL;
return -EINVAL;
- item = strndup(w, l);
+ item = strndup(w
ord
, l);
if (!item)
return -ENOMEM;
if (!item)
return -ENOMEM;
- switch (w[0]) {
+ switch (w
ord
[0]) {
case 's':
k = sd_id128_from_string(item+2, &id);
case 's':
k = sd_id128_from_string(item+2, &id);
@@
-2004,7
+2004,7
@@
_public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
&f->compress_buffer, &f->compress_buffer_size,
field, field_length, '=')) {
&f->compress_buffer, &f->compress_buffer_size,
field, field_length, '=')) {
-
uint64
_t rsize;
+
size
_t rsize;
r = decompress_blob(compression,
o->data.payload, l,
r = decompress_blob(compression,
o->data.payload, l,
@@
-2059,7
+2059,7
@@
static int return_data(sd_journal *j, JournalFile *f, Object *o, const void **da
compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4)
compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4)
-
uint64
_t rsize;
+
size
_t rsize;
int r;
r = decompress_blob(compression,
int r;
r = decompress_blob(compression,
@@
-2399,7
+2399,7
@@
_public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from,
_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot_id, uint64_t *from, uint64_t *to) {
Iterator i;
JournalFile *f;
_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot_id, uint64_t *from, uint64_t *to) {
Iterator i;
JournalFile *f;
- bool f
irst = tru
e;
+ bool f
ound = fals
e;
int r;
assert_return(j, -EINVAL);
int r;
assert_return(j, -EINVAL);
@@
-2418,21
+2418,21
@@
_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot
if (r == 0)
continue;
if (r == 0)
continue;
- if (f
irst
) {
+ if (f
ound
) {
if (from)
if (from)
- *from =
fr
;
+ *from =
MIN(fr, *from)
;
if (to)
if (to)
- *to = t;
- first = false;
+ *to = MAX(t, *to);
} else {
if (from)
} else {
if (from)
- *from =
MIN(fr, *from)
;
+ *from =
fr
;
if (to)
if (to)
- *to = MAX(t, *to);
+ *to = t;
+ found = true;
}
}
}
}
- return f
irst ? 0 : 1
;
+ return f
ound
;
}
void journal_print_header(sd_journal *j) {
}
void journal_print_header(sd_journal *j) {