fontconfig/fontconfig-ocloexec.patch
OBS User mrdocs 575dcd3fc4 Accepting request 90181 from home:elvigia:branches:M17N
- Support symbol visibility features
- Use O_CLOEXEC where needed in libfontconfig, callers may fork()
  and we end up leaking library internal fds to their child processes.

OBS-URL: https://build.opensuse.org/request/show/90181
OBS-URL: https://build.opensuse.org/package/show/M17N/fontconfig?expand=0&rev=44
2011-11-07 19:50:33 +00:00

61 lines
1.8 KiB
Diff

--- configure.in.orig
+++ configure.in
@@ -58,7 +58,9 @@ dnl ====================================
AM_CONFIG_HEADER(config.h)
-AC_PROG_CC
+AC_PROG_CC_STDC
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
AC_PROG_INSTALL
AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
@@ -168,7 +170,7 @@ AC_TYPE_PID_T
# Checks for library functions.
AC_FUNC_VPRINTF
AC_FUNC_MMAP
-AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48])
+AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp mkostemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48])
#
# Checks for iconv
--- src/fcatomic.c.orig
+++ src/fcatomic.c
@@ -107,10 +107,14 @@ FcAtomicLock (FcAtomic *atomic)
#ifdef HAVE_LINK
strcpy ((char *) atomic->tmp, (char *) atomic->file);
strcat ((char *) atomic->tmp, TMP_NAME);
+#ifdef HAVE_MKOSTEMP
+ fd = mkostemp ((char *) atomic->tmp, O_CLOEXEC);
+#else
fd = mkstemp ((char *) atomic->tmp);
+#endif
if (fd < 0)
return FcFalse;
- f = fdopen (fd, "w");
+ f = fdopen (fd, "we");
if (!f)
{
close (fd);
--- src/fccache.c.orig
+++ src/fccache.c
@@ -202,7 +202,7 @@ FcDirCacheOpenFile (const FcChar8 *cache
if (FcStat (cache_file, file_stat) < 0)
return -1;
#endif
- fd = open((char *) cache_file, O_RDONLY | O_BINARY);
+ fd = open((char *) cache_file, O_RDONLY | O_BINARY | O_CLOEXEC);
if (fd < 0)
return fd;
#ifndef _WIN32
@@ -909,7 +909,7 @@ FcDirCacheWrite (FcCache *cache, FcConfi
if (!FcAtomicLock (atomic))
goto bail3;
- fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT | O_BINARY, 0666);
+ fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT | O_BINARY | O_CLOEXEC, 0666);
if (fd == -1)
goto bail4;