bug-hurd
[Top][All Lists]
Advanced

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

[PATCH 12/16] trans: register symlink translators as important


From: Justus Winter
Subject: [PATCH 12/16] trans: register symlink translators as important
Date: Mon, 5 Aug 2013 12:06:36 +0200

Register any symlink translators running as root as important
processes at the proc server.

* trans/symlink.c (main): Mark us as important.
---
 trans/symlink.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/trans/symlink.c b/trans/symlink.c
index 03b5100..b3e8441 100644
--- a/trans/symlink.c
+++ b/trans/symlink.c
@@ -98,6 +98,18 @@ main (int argc, char **argv)
   io_restrict_auth (realnode, &realnodenoauth, 0, 0, 0, 0);
   mach_port_deallocate (mach_task_self (), realnode);
 
+  /* Mark us as important.  */
+  mach_port_t proc = getproc ();
+  if (proc == MACH_PORT_NULL)
+    error (2, err, "cannot get a handle to our process");
+
+  err = proc_mark_important (proc);
+  /* This might fail due to permissions, ignore any such errors.  */
+  if (err && err != EPERM)
+    error (2, err, "Cannot mark us as important");
+
+  mach_port_deallocate (mach_task_self (), proc);
+
   /* Launch */
   while (1)
     {
-- 
1.7.10.4




reply via email to

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