---
name: "selinux_restorecon_default_handle"
section: "3"
platform: "linux"
package: "libselinux1-dev"
version: "3.8.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/selinux_restorecon_default_handle"
---

# selinux\_restorecon\_default\_handle(3)

sets default parameters for selinux\_restorecon(3)

## NAME

selinux\_restorecon\_default\_handle - sets default parameters for [**selinux\_restorecon**(3)](/selinux_restorecon/3.md)

## SYNOPSIS

**#include \<selinux/restorecon.h\>**\
 **#include \<selinux/label.h\>**

**struct selabel\_handle \*selinux\_restorecon\_default\_handle(void);**

## DESCRIPTION

**selinux\_restorecon\_default\_handle**() sets default parameters for [**selinux\_restorecon**(3)](/selinux_restorecon/3.md) by calling [**selabel\_open**(3)](/selabel_open/3.md) with the **SELABEL\_OPT\_DIGEST** option only. This will enable a digest to be calculated on the currently loaded policy [**file\_contexts**(5)](/file_contexts/5.md) set of files as described in the **NOTES** section of [**selinux\_restorecon**(3)](/selinux_restorecon/3.md).

Calling **selinux\_restorecon\_default\_handle**() is optional, however if used then [**selinux\_restorecon\_set\_sehandle**(3)](/selinux_restorecon_set_sehandle/3.md) should be called with the returned handle to set this for use by [**selinux\_restorecon**(3)](/selinux_restorecon/3.md).

**selinux\_restorecon\_default\_handle**() is optional as [**selinux\_restorecon**(3)](/selinux_restorecon/3.md) will automatically call this and [**selinux\_restorecon\_set\_sehandle**(3)](/selinux_restorecon_set_sehandle/3.md) provided a handle has not already been set, for example by [**selinux\_restorecon\_set\_sehandle**(3)](/selinux_restorecon_set_sehandle/3.md) to set customised [**selabel\_open**(3)](/selabel_open/3.md) parameters.

## RETURN VALUE

A non-NULL handle value is returned on success. On error, NULL is returned and *errno* is set appropriately.

## SEE ALSO

[**selinux\_restorecon**(3)](/selinux_restorecon/3.md),\
 [**selinux\_restorecon\_set\_sehandle**(3)](/selinux_restorecon_set_sehandle/3.md),\
 [**selinux\_restorecon\_set\_exclude\_list**(3)](/selinux_restorecon_set_exclude_list/3.md),\
 [**selinux\_restorecon\_set\_alt\_rootpath**(3)](/selinux_restorecon_set_alt_rootpath/3.md),\
 [**selinux\_restorecon\_xattr**(3)](/selinux_restorecon_xattr/3.md)
