]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-login: reject invalid pidfd with -EBADF consistently
authorMike Yuan <me@yhndnzj.com>
Sun, 1 Jun 2025 07:04:27 +0000 (09:04 +0200)
committerMike Yuan <me@yhndnzj.com>
Wed, 4 Jun 2025 22:28:00 +0000 (00:28 +0200)
We got it mostly right except for one function, fix it.

src/libsystemd/sd-login/sd-login.c

index d730c5673c3b8c75e0f9ca19a86ae1a91e84f226..133e97b432883c8afde10963c91bf00bfaa8e321 100644 (file)
@@ -273,7 +273,7 @@ _public_ int sd_pidfd_get_owner_uid(int pidfd, uid_t *ret_uid) {
         pid_t pid;
         int r;
 
-        assert_return(pidfd >= 0, -EINVAL);
+        assert_return(pidfd >= 0, -EBADF);
 
         r = pidfd_get_pid(pidfd, &pid);
         if (r < 0)