fchdir - change working directory
#include <unistd.h>
int fchdir(int fd);
fchdir is identical to chdir(2), only that the directory is given as an open file descriptor.
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
Depending on the file system, other errors can be returned. The more general errors for fchdir(2) are listed below:
The prototype for fchdir(2) is only available if _BSD_SOURCE is defined (either explicitly, or implicitly, by not defining _POSIX_SOURCE or compiling with the -ansi flag).
The fchdir(2) call is compatible with SVr4, 4.4BSD and X/OPEN. SVr4 documents additional EIO, EINTR, and ENOLINK error conditions. X/OPEN documents additional EINTR and EIO error conditions.
3 pages link to fchdir(2):