bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/4] libdiskfs: Don't warn if requesting shutdown notification fa


From: Sergey Bugaev
Subject: [PATCH 1/4] libdiskfs: Don't warn if requesting shutdown notification fails with EPERM
Date: Mon, 26 Jun 2023 02:11:34 +0300

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.
---
 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:
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]