The value of errno
after chdir()
has exited needs to be checked to determine why it doesn't work.
Likely exit status values include:
- EACCESS (no permission for the target)
- ENOENT (file does not exist)
- ENOTDIR (target is a file, not a directory).
Check the documentation for your operating system's implementation for a complete list.