opens files without CLOEXEC
Submitted by Christian Persch (GNOME)
Assigned to poppler-bugs
Created attachment 141150 patch
Poppler opens files without O_CLOEXEC.
The attached patch fixes this in the libraries (but not the utils, since it doesn't matter there).
Since there already is a fopen() wrapper in goo/gfile, I changed invocations of fopen() to use openFile instead, and made a macro wrapper around openFile that adds the "e" mode (meaning CLOEXEC).
In the few places where open() is used instead of fopen(), I added O_CLOEXEC (with a fallback #define O_CLOEXEC 0 for those systems where O_CLOEXEC isn't defined).
(There was a problem in glib/ where including gfile.h leads to a conflict with glib.h in that both define a "GDir" type; I resolved this by making gfile.h not define its GDir if GFILE_NO_GDIR is #define'd before inclusion. I would have renamed GDir -> GooDir, for example, but it appears that header is installed and thus would have been an API change.)
Patch 141150, "patch":