Graphviz 13.1.2~dev.20250722.1051
Loading...
Searching...
No Matches
gv_fopen.h File Reference

wrapper around fopen for internal library usage More...

#include <stdio.h>
#include <util/api.h>
Include dependency graph for gv_fopen.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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

Function Documentation

◆ gv_fopen()

UTIL_API 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 32 of file gv_fopen.c.

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

Referenced by cat_libfile(), gvconfig(), gvdevice_initialize(), gvevent_read(), gvNextInputGraph(), gvusershape_file_access(), nextFile(), and user_init().

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