summaryrefslogtreecommitdiff
path: root/hostmux
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-09-05 21:40:52 +0000
committerMiles Bader <miles@gnu.org>1997-09-05 21:40:52 +0000
commit13bc3321026416c6b0245bf180f0bdcaac4174f0 (patch)
tree4815ea3ac2fdaeaf27ecd5c78e3f586560ae1b32 /hostmux
parenta2d6c2ad28481412ddeeb0a5b4c646cdf82e5c60 (diff)
(netfs_attempt_lookup):
Clear *NODE on errors. Check for lookup permission. Re-arrange code to correctly handle errors.
Diffstat (limited to 'hostmux')
-rw-r--r--hostmux/mux.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/hostmux/mux.c b/hostmux/mux.c
index 8dc11fc2..50c8e8e1 100644
--- a/hostmux/mux.c
+++ b/hostmux/mux.c
@@ -58,24 +58,31 @@ netfs_attempt_lookup (struct iouser *user, struct node *dir,
if (dir->nn->name)
err = ENOTDIR;
- else if (strcmp (name, ".") == 0)
- /* Current directory -- just add an additional reference to DIR and
- return it. */
- {
- netfs_nref (dir);
- *node = dir;
- err = 0;
- }
- else if (strcmp (name, "..") == 0)
- err = EAGAIN;
else
- err = lookup_host (dir->nn->mux, name, node);
+ err = fshelp_access (&dir->nn_stat, S_IEXEC, user);
- fshelp_touch (&dir->nn_stat, TOUCH_ATIME, hostmux_maptime);
+ if (! err)
+ {
+ if (strcmp (name, ".") == 0)
+ /* Current directory -- just add an additional reference to DIR and
+ return it. */
+ {
+ netfs_nref (dir);
+ *node = dir;
+ err = 0;
+ }
+ else if (strcmp (name, "..") == 0)
+ err = EAGAIN;
+ else
+ err = lookup_host (dir->nn->mux, name, node);
- mutex_unlock (&dir->lock);
+ fshelp_touch (&dir->nn_stat, TOUCH_ATIME, hostmux_maptime);
+ }
- if (! err)
+ mutex_unlock (&dir->lock);
+ if (err)
+ *node = 0;
+ else
mutex_lock (&(*node)->lock);
return err;