]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/install: rework an assert to appease gcc-13 26147/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 22 Jan 2023 17:21:13 +0000 (18:21 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 22 Jan 2023 17:25:56 +0000 (18:25 +0100)
With the previous form, gcc is confused and thinks that .type might be unset.

Fixes #26118.

src/shared/install.c

index 4eb15ca40e88647dfb01ddba243bbe41ba344949..51cae3b5a2c11cff3b6e60ed748a22caab7fc605 100644 (file)
@@ -342,7 +342,8 @@ void install_changes_dump(int r, const char *verb, const InstallChange *changes,
         assert(verb || r >= 0);
 
         for (size_t i = 0; i < n_changes; i++) {
-                assert(verb || changes[i].type >= 0);
+                if (changes[i].type < 0)
+                        assert(verb);
                 assert(changes[i].path);
 
                 /* When making changes here, make sure to also change install_error() in dbus-manager.c. */