From: Roland McGrath Date: Fri, 1 Oct 1999 20:02:34 +0000 (+0000) Subject: 1999-10-01 Roland McGrath X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e78f0910ea175e83d84472212244f585cd22ff3;p=thirdparty%2Fglibc.git 1999-10-01 Roland McGrath * 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. --- diff --git a/hurd/hurdfchdir.c b/hurd/hurdfchdir.c index efb705393e2..4a01f0719c2 100644 --- a/hurd/hurdfchdir.c +++ b/hurd/hurdfchdir.c @@ -27,17 +27,30 @@ 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; }