summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Bugaev <bugaevc@gmail.com>2023-06-26 02:11:34 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-07-03 01:39:34 +0200
commit005212e56eb02f01ff732eaa44b360eb8e126d03 (patch)
tree812a61ebdbe3209c3d48cbb73a90ed5b9cd2fa45
parent955544335bad2db9a1d30b17aead35ad1f5c83be (diff)
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>
-rw-r--r--libdiskfs/init-startup.c6
1 files 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: