Back to index

glibc  2.9
Functions
hurdfchdir.c File Reference
#include <errno.h>
#include <unistd.h>
#include <hurd.h>
#include <hurd/port.h>
#include <hurd/fd.h>
#include <fcntl.h>

Go to the source code of this file.

Functions

int _hurd_change_directory_port_from_fd (struct hurd_port *portcell, int fd)

Function Documentation

int _hurd_change_directory_port_from_fd ( struct hurd_port portcell,
int  fd 
)

Definition at line 28 of file hurdfchdir.c.

{
  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;
                      /* We look up "." to force ENOTDIR if it's not a
                         directory and EACCES if we don't have search
                         permission.  */
                      file_t dir = __file_name_lookup_under (port, ".",
                                                        O_NOTRANS, 0);
                      if (dir == MACH_PORT_NULL)
                        ret = -1;
                      else
                        {
                          _hurd_port_set (portcell, dir);
                          ret = 0;
                        }
                      ret;
                     }));

  HURD_CRITICAL_END;

  return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function: