]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: replace dead code path with an assert
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Sat, 11 Apr 2026 10:33:44 +0000 (12:33 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Sat, 11 Apr 2026 12:53:07 +0000 (14:53 +0200)
Coverity complains that the -EOPNOTSUPP can never be returned, because
we always have !watch_fallback==locked.

CID#1654169

src/libsystemd/sd-event/sd-event.c

index 9256ddd81bfeaa08801871a98b662f9510b0becb..9e7ba7813cde9290de8ba41a176e7b8302ae62bc 100644 (file)
@@ -2048,11 +2048,13 @@ static int event_add_pressure(
                 if (errno != ENOENT)
                         return -errno;
 
-                /* We got ENOENT. Three options now: try the fallback if we have one, or return the error as
-                 * is (if based on user/env config), or return -EOPNOTSUPP (because we picked the path, and
-                 * the PSI service apparently is not supported) */
-                if (!watch_fallback)
-                        return locked ? -ENOENT : -EOPNOTSUPP;
+                /* We got ENOENT. Two options now: try the fallback if we have one, or return the error as is
+                 * (when based on user/env config). */
+
+                if (!watch_fallback) {
+                        assert(locked);
+                        return -ENOENT;
+                }
 
                 path_fd = open(watch_fallback, O_PATH|O_CLOEXEC);
                 if (path_fd < 0) {