fdistrusted()

Updated: April 19, 2023

Determine if a file is trusted

Synopsis:

#include <unistd.h>

int fdistrusted( int fd );

Arguments:

fd
A descriptor for the file that you want to check.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The fdistrusted() function determines whether or not the file associated with the given file descriptor is trusted or is in a trusted filesystem. QNX recommends that you use fchecktrust() instead of fdistrusted().

This function always considers a file to be trusted when pathtrust is not enabled (i.e., procnto starts without -qt). This behavior means that programs do not need to know if the system is using pathtrust.

You can use the pathtrust feature to prevent processes from executing untrusted files. See “Pathtrust” in the System Security Guide.

Returns:

EOK if the file is trusted, EPERM if it isn't, or some other errno value if an error occurred.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes