Projects
Mega:23.03
systemd
_service:tar_scm:backport-journal-Use-separate-...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-journal-Use-separate-variable-for-Data-object-in-sd_.patch of Package systemd
From a1ca5320ec74f5112d32338e3061a34f17c4b954 Mon Sep 17 00:00:00 2001 From: Daan De Meyer <daan.j.demeyer@gmail.com> Date: Wed, 17 Nov 2021 16:44:21 +0000 Subject: [PATCH] journal: Use separate variable for Data object in sd_journal_get_data() A little cleanup to make the next change easier. We're not moving to a new Entry object in the for loop so there's no danger of changing the Entry object window. (cherry picked from commit 847c7ee8c3c1a6cecd02501562b1afd8dd3c51de) Conflict:NA Reference:https://github.com/systemd/systemd/commit/a1ca5320ec74f5112d32338e3061a34f17c4b954 --- src/libsystemd/sd-journal/sd-journal.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c index 02d4582c98..18ede19e26 100644 --- a/src/libsystemd/sd-journal/sd-journal.c +++ b/src/libsystemd/sd-journal/sd-journal.c @@ -2300,6 +2300,7 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void ** n = journal_file_entry_n_items(o); for (i = 0; i < n; i++) { + Object *d; uint64_t p, l; le64_t le_hash; size_t t; @@ -2307,20 +2308,20 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void ** p = le64toh(o->entry.items[i].object_offset); le_hash = o->entry.items[i].hash; - r = journal_file_move_to_object(f, OBJECT_DATA, p, &o); + r = journal_file_move_to_object(f, OBJECT_DATA, p, &d); if (r < 0) return r; - if (le_hash != o->data.hash) + if (le_hash != d->data.hash) return -EBADMSG; - l = le64toh(o->object.size) - offsetof(Object, data.payload); + l = le64toh(d->object.size) - offsetof(Object, data.payload); - compression = o->object.flags & OBJECT_COMPRESSION_MASK; + compression = d->object.flags & OBJECT_COMPRESSION_MASK; if (compression) { #if HAVE_COMPRESSION r = decompress_startswith(compression, - o->data.payload, l, + d->data.payload, l, &f->compress_buffer, field, field_length, '='); if (r < 0) @@ -2331,7 +2332,7 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void ** size_t rsize; r = decompress_blob(compression, - o->data.payload, l, + d->data.payload, l, &f->compress_buffer, &rsize, j->data_threshold); if (r < 0) @@ -2346,23 +2347,19 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void ** return -EPROTONOSUPPORT; #endif } else if (l >= field_length+1 && - memcmp(o->data.payload, field, field_length) == 0 && - o->data.payload[field_length] == '=') { + memcmp(d->data.payload, field, field_length) == 0 && + d->data.payload[field_length] == '=') { t = (size_t) l; if ((uint64_t) t != l) return -E2BIG; - *data = o->data.payload; + *data = d->data.payload; *size = t; return 0; } - - r = journal_file_move_to_object(f, OBJECT_ENTRY, f->current_offset, &o); - if (r < 0) - return r; } return -ENOENT; -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2