]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
1999-10-01 Roland McGrath <roland@baalperazim.frob.com>
authorRoland McGrath <roland@gnu.org>
Fri, 1 Oct 1999 20:02:34 +0000 (20:02 +0000)
committerRoland McGrath <roland@gnu.org>
Fri, 1 Oct 1999 20:02:34 +0000 (20:02 +0000)
* hurd/hurdfchdir.c (_hurd_change_directory_port_from_fd): Rewrite
without HURD_DPORT_USE to clean up warnings.
* hurd/dtable.c (get_dtable_port): Likewise.

hurd/hurdfchdir.c

index efb705393e20f9f4da6f74f1160f20e1ec18c7b3..4a01f0719c2762cd32515fea491cd96e6a9283a6 100644 (file)
 int
 _hurd_change_directory_port_from_fd (struct hurd_port *portcell, int fd)
 {
-  error_t err;
-  file_t dir;
-
-  err = HURD_DPORT_USE (fd,
-                       ({
-                         dir = __file_name_lookup_under (port, ".", 0, 0);
-                         dir == MACH_PORT_NULL ? errno : 0;
-                       }));
-
-  if (! err)
-    _hurd_port_set (portcell, dir);
-
-  return err ? __hurd_fail (err) : 0;
+  int ret;
+  struct hurd_fd *d = _hurd_fd_get (fd);
+
+  if (!d)
+    return __hurd_fail (EBADF);
+
+  HURD_CRITICAL_BEGIN;
+
+  ret = HURD_PORT_USE (&d->port,
+                      ({
+                        int ret;
+                        file_t dir = __file_name_lookup_under (port, ".",
+                                                               0, 0);
+                        if (dir == MACH_PORT_NULL)
+                          ret = -1;
+                        else
+                          {
+                            _hurd_port_set (portcell, dir);
+                            ret = 0;
+                          }
+                        ret;
+                      }));
+
+  HURD_CRITICAL_END;
+
+  return ret;
 }