Back to index

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

Go to the source code of this file.

Functions

int fchroot (int fd)

Function Documentation

int fchroot ( int  fd)

Definition at line 27 of file fchroot.c.

{
  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)
    {
      file_t root;

      /* Prevent going through DIR's ..  */
      err = __file_reparent (dir, MACH_PORT_NULL, &root);
      __mach_port_deallocate (__mach_task_self (), dir);
      if (! err)
       _hurd_port_set (&_hurd_ports[INIT_PORT_CRDIR], root);
    }

  return err ? __hurd_fail (err) : 0;
}

Here is the call graph for this function: