commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 04/06: Show firmlink mounts to mount points


From: Samuel Thibault
Subject: [hurd] 04/06: Show firmlink mounts to mount points
Date: Wed, 16 Mar 2016 01:36:35 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 0bc52ecb504401e089e1aa335c56e0c5db6d8e32
Author: Samuel Thibault <address@hidden>
Date:   Tue Mar 15 22:22:07 2016 +0100

    Show firmlink mounts to mount points
    
    * trans/mtab.c (mtab_populate): Always open the underlying node, and pass
    it to mtab_mark_as_seen instead of the translated node.
---
 trans/mtab.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/trans/mtab.c b/trans/mtab.c
index e855080..e0fcb46 100644
--- a/trans/mtab.c
+++ b/trans/mtab.c
@@ -344,7 +344,7 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
   error_t err = 0;
 
   /* These resources are freed in the epilogue.         */
-  file_t node = MACH_PORT_NULL;
+  file_t node = MACH_PORT_NULL, underlying_node = MACH_PORT_NULL;
   char *argz = NULL;
   size_t argz_len = 0;
   char **argv = NULL;
@@ -357,19 +357,19 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
   char *children = NULL;
   size_t children_len = 0;
 
-  if (! insecure)
+  /* Get the underlying node.  */
+  underlying_node = file_name_lookup (path, O_NOTRANS, 0666);
+  if (underlying_node == MACH_PORT_NULL)
     {
-      /* Get the underlying node.  */
-      node = file_name_lookup (path, O_NOTRANS, 0666);
-      if (node == MACH_PORT_NULL)
-        {
-          err = errno;
-          goto errout;
-        }
+      err = errno;
+      goto errout;
+    }
 
+  if (! insecure)
+    {
       /* Check who owns the node the translator is bound to.  */
       io_statbuf_t st;
-      err = io_stat (node, &st);
+      err = io_stat (underlying_node, &st);
       if (err)
        goto errout;
 
@@ -378,8 +378,6 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
          err = EPERM;
          goto errout;
        }
-
-      mach_port_deallocate (mach_task_self (), node);
     }
 
   /* (Re-)do the lookup without O_NOTRANS to get the root node.  */
@@ -397,7 +395,7 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
     }
 
   /* Avoid running in circles.  */
-  if (mtab_mark_as_seen (mtab, node))
+  if (mtab_mark_as_seen (mtab, underlying_node))
     {
       err = 0;
       goto errout;
@@ -509,6 +507,8 @@ mtab_populate (struct mtab *mtab, const char *path, int 
insecure)
       }
 
  errout:
+  if (underlying_node != MACH_PORT_NULL)
+    mach_port_deallocate (mach_task_self (), underlying_node);
   if (node != MACH_PORT_NULL)
     mach_port_deallocate (mach_task_self (), node);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

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