Pass close-on-exec flag to lcms for non-Windows OS (#2816)

This ensures child processes do not inherit open file descriptors
and will close a small but long-standing bug reported against
sharp over five years ago.

The change to lcms2 to support this is backwards compatible so
the flag will be ignored by existing versions.

The fopen 'e' flag will soon be part of the POSIX standard, and
is already supported in Linux and BSD. macOS currently ignores
it but will add support soon. Only Windows has a problem with it,
hence the ifdef wrapper.
This commit is contained in:
Lovell Fuller 2022-05-21 17:28:40 +01:00 committed by GitHub
parent 2ef1b198fb
commit c1f6995256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1321,7 +1321,11 @@ vips_icc_ac2rc( VipsImage *in, VipsImage **out, const char *profile_filename )
double *mul;
int i;
#ifdef G_OS_WIN32
if( !(profile = cmsOpenProfileFromFile( profile_filename, "r" )) )
#else /*!G_OS_WIN32*/
if( !(profile = cmsOpenProfileFromFile( profile_filename, "re" )) )
#endif /*G_OS_WIN32*/
return( -1 );
#ifdef DEBUG