areadlink(3)

NAME

areadlink \- read value of a symolic link

SYNOPSIS

#include <pathfns.h>

char *areadlink(const char *path);

DESCRIPTION

This function reads the value of a symbolic link into a buffer allocated with malloc(3), and adds a null terminator.

The behaviour is undefined if path is a null pointer.

RETURN VALUES

If the return value is not a null pointer then the operation succeeded and the return value is a pointer to the newly created string.

If the return value is a null pointer then the operation failed and errno is set appropriately:

ENOTDIR

A component of path is not a directory.

ENAMETOOLONG

path, or a component of path, is too long.

ENOENT

path does not exist.

EACCES

Permission denied accessing path.

ELOOP

path contains too many symbolic links.

EINVAL

path is not a symbolic link.

EIO

An I/O error occurred while reading from the file system.

ENOMEM

Insufficient memory (provided the local malloc sets errno).

NOTES

readlink(2) performs a similar operation to this function, but it has an incredibly inconvenient interface.

SEE ALSO

arealpath(3), readlink(2), malloc(3), free(3)