up | Inhaltsverzeichniss | Kommentar

Manual page for CHDIR(2V)

chdir - change current working directory

SYNOPSIS

int chdir(path)
char *path;

int fchdir(fd) int fd;

DESCRIPTION

chdir() and fchdir() make the directory specified by path or fd the current working directory. Subsequent references to pathnames not starting with `/' are relative to the new current working directory.

In order for a directory to become the current directory, a process must have execute (search) access to the directory.

RETURN VALUES

chdir() returns:

0
on success.
-1
on failure and sets errno to indicate the error.

ERRORS

EACCES
Search permission is denied for a component of the pathname.
ENAMETOOLONG
The length of the path argument exceeds {PATH_MAX}.

A pathname component is longer than {NAME_MAX} while {_POSIX_NO_TRUNC} is in effect (see pathconf.2v

ENOENT
The named directory does not exist.
ENOTDIR
A component of the pathname is not a directory.

SYSTEM V ERRORS

In addition to the above, the following may also occur:

ENOENT
path points to an empty string.

WARNINGS

fchdir() is provided as a performance enhancement and is guaranteed to fail under certain conditions. In particular, if auditing is active the call will never succeed, and EINVAL will be returned. Applications which use this system call must be coded to detect this failure and switch to using chdir() from that point on.


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97