summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-07-02 16:59:32 +0200
committerGitHub <noreply@github.com>2022-07-02 16:59:32 +0200
commit7b3b2e5ad6a99e5089165ec3c9c2b2756ae5503e (patch)
tree39867466450014925ceeae31bd81df47a9faaa55 /src
parenttest: copy libgcc_s.so.1 to TPM2 test image on Debian-like systems (diff)
parenthomework: silence gcc warning (diff)
downloadsystemd-7b3b2e5ad6a99e5089165ec3c9c2b2756ae5503e.tar.xz
systemd-7b3b2e5ad6a99e5089165ec3c9c2b2756ae5503e.zip
Merge pull request #23865 from keszybz/drop-memcpy-call
sd-id128: avoid an unnecessary function call in inline helper
Diffstat (limited to 'src')
-rw-r--r--src/home/homework-luks.c4
-rw-r--r--src/journal/journalctl.c2
-rw-r--r--src/libsystemd/sd-journal/journal-verify.c2
-rw-r--r--src/systemd/sd-id128.h2
4 files changed, 5 insertions, 5 deletions
diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c
index 97269db80d..0108ab5407 100644
--- a/src/home/homework-luks.c
+++ b/src/home/homework-luks.c
@@ -180,7 +180,7 @@ static int probe_file_system_by_path(const char *path, char **ret_fstype, sd_id1
fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NONBLOCK);
if (fd < 0)
- return -errno;
+ return negative_errno();
return probe_file_system_by_fd(fd, ret_fstype, ret_uuid);
}
@@ -1230,7 +1230,7 @@ int home_setup_luks(
PasswordCache *cache,
UserRecord **ret_luks_home) {
- sd_id128_t found_partition_uuid = SD_ID128_NULL, found_luks_uuid = SD_ID128_NULL, found_fs_uuid = SD_ID128_NULL;
+ sd_id128_t found_partition_uuid, found_fs_uuid, found_luks_uuid = SD_ID128_NULL;
_cleanup_(user_record_unrefp) UserRecord *luks_home = NULL;
_cleanup_(erase_and_freep) void *volume_key = NULL;
size_t volume_key_size = 0;
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 6ee49a6913..127c3d491b 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -2164,7 +2164,7 @@ int main(int argc, char *argv[]) {
bool previous_boot_id_valid = false, first_line = true, ellipsized = false, need_seek = false;
bool use_cursor = false, after_cursor = false;
_cleanup_(sd_journal_closep) sd_journal *j = NULL;
- sd_id128_t previous_boot_id;
+ sd_id128_t previous_boot_id = {}; /* Unnecessary initialization to appease gcc */
int n_shown = 0, r, poll_fd = -1;
setlocale(LC_ALL, "");
diff --git a/src/libsystemd/sd-journal/journal-verify.c b/src/libsystemd/sd-journal/journal-verify.c
index 543d7ed026..40aff67ee8 100644
--- a/src/libsystemd/sd-journal/journal-verify.c
+++ b/src/libsystemd/sd-journal/journal-verify.c
@@ -820,7 +820,7 @@ int journal_file_verify(
uint64_t p = 0, last_epoch = 0, last_tag_realtime = 0, last_sealed_realtime = 0;
uint64_t entry_seqnum = 0, entry_monotonic = 0, entry_realtime = 0;
- sd_id128_t entry_boot_id;
+ sd_id128_t entry_boot_id = {}; /* Unnecessary initialization to appease gcc */
bool entry_seqnum_set = false, entry_monotonic_set = false, entry_realtime_set = false, found_main_entry_array = false;
uint64_t n_weird = 0, n_objects = 0, n_entries = 0, n_data = 0, n_fields = 0, n_data_hash_tables = 0, n_field_hash_tables = 0, n_entry_arrays = 0, n_tags = 0;
usec_t last_usec = 0;
diff --git a/src/systemd/sd-id128.h b/src/systemd/sd-id128.h
index 92682166d7..3303c374ce 100644
--- a/src/systemd/sd-id128.h
+++ b/src/systemd/sd-id128.h
@@ -116,7 +116,7 @@ int sd_id128_get_boot_app_specific(sd_id128_t app_id, sd_id128_t *ret);
#a #b #c #d "-" #e #f "-" #g #h "-" #i #j "-" #k #l #m #n #o #p
_sd_pure_ static __inline__ int sd_id128_equal(sd_id128_t a, sd_id128_t b) {
- return memcmp(&a, &b, 16) == 0;
+ return a.qwords[0] == b.qwords[0] && a.qwords[1] == b.qwords[1];
}
int sd_id128_string_equal(const char *s, sd_id128_t id);