Graphviz 12.1.0~dev.20240716.1117
Loading...
Searching...
No Matches
gv_fopen.c File Reference

C implementation of gv_fopen More...

#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <util/gv_fopen.h>
Include dependency graph for gv_fopen.c:

Go to the source code of this file.

Functions

static FILE * fopen_ (const char *filename, const char *mode)
 platform abstraction over fopen
 
FILE * gv_fopen (const char *filename, const char *mode)
 

Function Documentation

◆ fopen_()

static FILE * fopen_ ( const char *  filename,
const char *  mode 
)
static

Definition at line 15 of file gv_fopen.c.

References NULL.

Referenced by gv_fopen().

Here is the caller graph for this function:

◆ gv_fopen()

FILE * gv_fopen ( const char *  filename,
const char *  mode 
)

open a file, setting close-on-exec

Generally, library code should set close-on-exec (O_CLOEXEC) on file descriptors it creates to avoid child processes of concurrent fork+exec operations accidentally inheriting copies of the descriptors. It is tricky to achieve this without races. This function attempts to avoid the common problems when trying to do this with fopen.

Parameters
filenameA filename, as you would pass to fopen
modeA mode, as you would pass to fopen
Returns
A file handle with close-on-exit set on success or NULL on failure

Definition at line 31 of file gv_fopen.c.

References err, flags, fopen_(), and NULL.

Referenced by gvNextInputGraph(), and nextFile().

Here is the call graph for this function:
Here is the caller graph for this function: