From 005212e56eb02f01ff732eaa44b360eb8e126d03 Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Mon, 26 Jun 2023 02:11:34 +0300 Subject: libdiskfs: Don't warn if requesting shutdown notification fails with EPERM The code already ignores proc_mark_important failing with EPERM; do the same for opening /servers/startup and startup_request_notification. All of these calls will fail for unprivileged mounts. Also plug a port leak: we want to deallocate the "init" port whether the RPC succeeds or not. Message-Id: <20230625231137.403096-1-bugaevc@gmail.com> --- libdiskfs/init-startup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libdiskfs/init-startup.c b/libdiskfs/init-startup.c index a4095847..0cc7f647 100644 --- a/libdiskfs/init-startup.c +++ b/libdiskfs/init-startup.c @@ -223,6 +223,8 @@ _diskfs_init_completed (void) if (init == MACH_PORT_NULL) { err = errno; + if (err == EPERM) + return; goto errout; } @@ -233,11 +235,11 @@ _diskfs_init_completed (void) err = startup_request_notification (init, notify, MACH_MSG_TYPE_COPY_SEND, name); mach_port_deallocate (mach_task_self (), notify); + mach_port_deallocate (mach_task_self (), init); free (name); - if (err) + if (err && err != EPERM) goto errout; - mach_port_deallocate (mach_task_self (), init); return; errout: -- cgit v1.2.3