---
name: "explain_access_or_die"
section: "3"
platform: "linux"
package: "libexplain-dev"
version: "1.4.D001-16"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/explain_access_or_die"
---

# explain\_access\_or\_die(3)

check permissions for a file and report errors

## NAME

explain\_access\_or\_die - check permissions for a file and report errors

## SYNOPSIS

\#include \<libexplain/libexplain.h\>\
 void explain\_access\_or\_die(const char \*pathname, int mode);

## DESCRIPTION

The explain\_access\_or\_die function is used to call the [*access*(2)](/access/2.md) system call and check the result.  On failure it prints an explanation of the error, obtained from [*explain\_access*(3)](/explain_access/3.md), and then terminates by calling `exit(EXIT_FAILURE)`.

`explain_access_or_die(pathname, mode);`

- *pathname*

  The pathname, exactly as to be passed to the [*access*(2)](/access/2.md) system call.

- *mode*

  The mode, exactly as to be passed to the [*access*(2)](/access/2.md) system call.

- Returns:

  Only ever return on success. On failure process will exit.

## COPYRIGHT

libexplain version 1.4\
 Copyright (C) 2008 Peter Miller

## AUTHOR

Written by Peter Miller \<pmiller@opensource.org.au\>
