[Fontconfig-bugs] [Bug 47705] Using O_CLOEXEC

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Mar 22 08:03:21 PDT 2012


https://bugs.freedesktop.org/show_bug.cgi?id=47705

--- Comment #2 from Behdad Esfahbod <freedesktop at behdad.org> 2012-03-22 08:03:21 PDT ---
Comment on attachment 58855
  --> https://bugs.freedesktop.org/attachment.cgi?id=58855
Using O_CLOEXEC in 2.9.0.

Review of attachment 58855:
 --> (https://bugs.freedesktop.org/page.cgi?id=splinter.html&bug=47705&attachment=58855)
-----------------------------------------------------------------

::: src/fcatomic.c.orig
@@ +113,1 @@
>      fd = mkstemp ((char *) atomic->tmp);

Maybe use the fcntl() equivalent in this case?

@@ +115,3 @@
>      if (fd < 0)
>  	return FcFalse;
> +    f = fdopen (fd, "we");

Do other systems just ignore the 'e' modifier transparently?  Infact, since
this is fdopen as opposed to fopen, I think you don't need the modifier, since
the fd is already open.

::: src/fccache.c.orig
@@ +216,4 @@
>      if (FcStat (cache_file, file_stat) < 0)
>          return -1;
>  #endif
> +    fd = open((char *) cache_file, O_RDONLY | O_BINARY | O_CLOEXEC);

Since O_CLOEXEC is a Linux extension, you need ifdef around this I guess?  And
fall back to the fcntl() equivalent?  Looks like we need an internal FcOpen :).

@@ +963,4 @@
>      if (!FcAtomicLock (atomic))
>  	goto bail3;
>  
> +    fd = open((char *)FcAtomicNewFile (atomic), O_RDWR | O_CREAT | O_BINARY | O_CLOEXEC, 0666);

Same here.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Fontconfig-bugs mailing list