sd-journal: properly parse cursor strings

This commit is contained in:
Lennart Poettering 2012-09-27 23:28:54 +02:00
parent 08ace05beb
commit be3ea5eaf2

View file

@ -983,35 +983,35 @@ _public_ int sd_journal_seek_cursor(sd_journal *j, const char *cursor) {
case 's': case 's':
seqnum_id_set = true; seqnum_id_set = true;
k = sd_id128_from_string(w+2, &seqnum_id); k = sd_id128_from_string(item+2, &seqnum_id);
break; break;
case 'i': case 'i':
seqnum_set = true; seqnum_set = true;
if (sscanf(w+2, "%llx", &seqnum) != 1) if (sscanf(item+2, "%llx", &seqnum) != 1)
k = -EINVAL; k = -EINVAL;
break; break;
case 'b': case 'b':
boot_id_set = true; boot_id_set = true;
k = sd_id128_from_string(w+2, &boot_id); k = sd_id128_from_string(item+2, &boot_id);
break; break;
case 'm': case 'm':
monotonic_set = true; monotonic_set = true;
if (sscanf(w+2, "%llx", &monotonic) != 1) if (sscanf(item+2, "%llx", &monotonic) != 1)
k = -EINVAL; k = -EINVAL;
break; break;
case 't': case 't':
realtime_set = true; realtime_set = true;
if (sscanf(w+2, "%llx", &realtime) != 1) if (sscanf(item+2, "%llx", &realtime) != 1)
k = -EINVAL; k = -EINVAL;
break; break;
case 'x': case 'x':
xor_hash_set = true; xor_hash_set = true;
if (sscanf(w+2, "%llx", &xor_hash) != 1) if (sscanf(item+2, "%llx", &xor_hash) != 1)
k = -EINVAL; k = -EINVAL;
break; break;
} }