Qsmtp  0.30dev
Macros | Functions
diropen.h File Reference

declarations of functions for handling directories More...

#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>

Go to the source code of this file.

Macros

#define _GNU_SOURCE   /* needed for O_PATH according to manpage */
 
#define __USE_GNU   /* needed for O_PATH according to code */
 

Functions

static int get_dirfd (int base, const char *dirname)
 get a file descriptor for the given directory More...
 

Detailed Description

declarations of functions for handling directories

Function Documentation

static int get_dirfd ( int  base,
const char *  dirname 
)
inlinestatic

get a file descriptor for the given directory

Parameters
basea filedescriptor to a base directory
dirnamename of the directory
Returns
the file descriptor
Return values
-1the given name cannot be opened as directory (errno is set)

This tries to open the given name as directory. In case this returns a valid descriptor it is not guaranteed that the descriptor can be used for anything else than being an anchor point for openat() calls.

If dirname is an absolute filename base will be ignored.

The CLOEXEC flag will be set for the descriptor if supported by the underlying platform.