|CHDIR(2)||Linux Programmer's Manual||CHDIR(2)|
int chdir(const char *path); int fchdir(int fd);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
_XOPEN_SOURCE >= 500 || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L || /* Glibc up to and including 2.19: */ _BSD_SOURCE
fchdir() is identical to chdir(); the only difference is that the directory is given as an open file descriptor.
- Search permission is denied for one of the components of path. (See also path_resolution(7).)
- path points outside your accessible address space.
- An I/O error occurred.
- Too many symbolic links were encountered in resolving path.
- path is too long.
- The directory specified in path does not exist.
- Insufficient kernel memory was available.
- A component of path is not a directory.
The general errors for fchdir() are listed below:
- Search permission was denied on the directory open on fd.
- fd is not a valid file descriptor.
- fd does not refer to a directory.