[PATCH 2/3] Xext/shm: Better support cases where O_CLOEXEC is not defined
Jeremy Huddleston Sequoia
jeremyhu at apple.com
Mon Sep 12 17:53:39 UTC 2016
> On Sep 12, 2016, at 04:33, Julien Cristau <jcristau at debian.org> wrote:
>
> On Sun, Sep 11, 2016 at 20:01:50 -0700, Jeremy Huddleston Sequoia wrote:
>
>> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
>> ---
>> Xext/shm.c | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
> Does anything have O_TMPFILE but not O_CLOEXEC?
Not sure, but I figured it'd be good to be on the safe side. Snow Leopard (OS X 10.6) doesn't have either. I saw this when making the change to check for O_CLOEXEC in os/inputthread and thought I'd bring it up for consideration.
If you don't think that O_TMPFILE && !O_CLOEXEC is something we'll see in the wild, I'm happy to just leave it as is.
--Jeremy
> Cheers,
> Julien
>
>> diff --git a/Xext/shm.c b/Xext/shm.c
>> index 125000f..7a45dbd 100644
>> --- a/Xext/shm.c
>> +++ b/Xext/shm.c
>> @@ -1202,7 +1202,11 @@ shm_tmpfile(void)
>> int flags;
>> char template[] = SHMDIR "/shmfd-XXXXXX";
>> #ifdef O_TMPFILE
>> - fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
>> + flags = O_TMPFILE|O_RDWR|O_EXCL;
>> +#ifdef O_CLOEXEC
>> + flags |= O_CLOEXEC;
>> +#endif
>> + fd = open(SHMDIR, flags, 0666);
>> if (fd >= 0) {
>> ErrorF ("Using O_TMPFILE\n");
>> return fd;
>> --
>> 2.10.0 (Apple Git-99)
>>
>> _______________________________________________
>> xorg-devel at lists.x.org: X.Org development
>> Archives: http://lists.x.org/archives/xorg-devel
>> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4465 bytes
Desc: not available
URL: <https://lists.x.org/archives/xorg-devel/attachments/20160912/e69f1971/attachment.bin>
More information about the xorg-devel
mailing list