---
name: "af_error"
section: "3"
platform: "linux"
package: "atfs-dev"
version: "1.4pl6-15+b1"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/af_error"
---

# af\_error(3)

AtFS error handling

## NAME

af\_errno, af\_perror, af\_errmsg, af\_cleanup - AtFS error handling

## SYNOPSIS

\#include \<atfs.h\>

int	af\_errno

void	af\_perror (char \*string)

char\*	af\_errmsg (char \*string)

int	af\_cleanup (void)

## DESCRIPTION

*af\_errno* is the global AtFS error number variable. If an AtFS functions returns with an error, *af\_errno* is set to indicate the appropriate error number. It is not cleared upon successful calls. The [af\_intro(3)](/af_intro/3.md) manual page gives an overview of all error codes.

*af\_perror* produces a short error message of the form described in [perror(3)](/perror/3.md). This message will be written to standard error. If the last error encountered during an AtFS application was an AtFS-specific error, a corresponding message is generated, otherwise af\_perror calls [perror(3)](/perror/3.md).

*af\_errmsg* does the same as af\_perror but returns the message rather than writing to standard error. The result string resides in static memory and hence will be overwritten on subsequent calls of af\_errmsg.

*Af\_cleanup* serves as cleanup routine upon premature termination of an AtFS application. It removes temporary files and frees all allocated memory.

## SEE ALSO

[intro(2)](/intro/2.md), [af\_intro(3)](/af_intro/3.md), [perror(3)](/perror/3.md)
