test_file_permission_and_size()

test_file_permission_and_size()#

test_file_permission_and_size() verifies if a file has the specified permissions and size.

Prototype

int test_file_permission_and_size(
    const char *path,    
    mode_t      permission,
    off_t       size
);

Parameters

Key

Type

Description

path

const char *

Path to the file to be checked.

permission

mode_t

Expected file permission mode.

size

off_t

Expected file size in bytes.


Return Value

Returns 0 if the file matches the expected permissions and size, otherwise returns -1.

Notes

This function internally calls file_permission() and file_size() to retrieve the file’s attributes.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples