Date: Thu, 6 Jul 2017 03:02:59 +0000 (UTC) From: Jan Beich <jbeich@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org Subject: svn commit: r445125 - in branches/2017Q2/x11/libxshmfence: . files Message-ID: <201707060302.v6632xK2056763@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jbeich Date: Thu Jul 6 03:02:59 2017 New Revision: 445125 URL: https://svnweb.freebsd.org/changeset/ports/445125 Log: MFH: r445016 x11/libxshmfence: don't leak /tmp/shmfd* files with O_CLOEXEC - Both mkostemp() and mkstemp() need explicit call to unlink() - Unobfuscate fallback if both O_TMPFILE and mksotemp() are N/A - O_TMPFILE (Linux-only) appeared after O_CLOEXEC, no need to check PR: 217676 (for tracking) Approved by: ports-secteam (junovitch) Modified: branches/2017Q2/x11/libxshmfence/Makefile branches/2017Q2/x11/libxshmfence/files/patch-src__xshmfence_alloc.c Directory Properties: branches/2017Q2/ (props changed) Modified: branches/2017Q2/x11/libxshmfence/Makefile ============================================================================== --- branches/2017Q2/x11/libxshmfence/Makefile Thu Jul 6 03:01:05 2017 (r445124) +++ branches/2017Q2/x11/libxshmfence/Makefile Thu Jul 6 03:02:59 2017 (r445125) @@ -2,7 +2,7 @@ PORTNAME= libxshmfence PORTVERSION= 1.2 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= x11 MAINTAINER= x11@FreeBSD.org Modified: branches/2017Q2/x11/libxshmfence/files/patch-src__xshmfence_alloc.c ============================================================================== --- branches/2017Q2/x11/libxshmfence/files/patch-src__xshmfence_alloc.c Thu Jul 6 03:01:05 2017 (r445124) +++ branches/2017Q2/x11/libxshmfence/files/patch-src__xshmfence_alloc.c Thu Jul 6 03:02:59 2017 (r445125) @@ -1,24 +1,14 @@ --- src/xshmfence_alloc.c.orig 2015-03-04 15:28:23 UTC +++ src/xshmfence_alloc.c -@@ -67,15 +67,19 @@ int - xshmfence_alloc_shm(void) - { - char template[] = SHMDIR "/shmfd-XXXXXX"; -- int fd; -+ int fd = -1; - - #if HAVE_MEMFD_CREATE - fd = memfd_create("xshmfence", MFD_CLOEXEC|MFD_ALLOW_SEALING); - if (fd < 0) - #endif - { --#ifdef O_TMPFILE -+#if defined(O_CLOEXEC) -+#if defined(HAVE_MKOSTEMP) -+ fd = mkostemp(template, O_CLOEXEC); -+#elif defined(O_TMPFILE) - fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666); -+#endif +@@ -79,7 +79,11 @@ xshmfence_alloc_shm(void) if (fd < 0) #endif { ++#ifdef HAVE_MKOSTEMP ++ fd = mkostemp(template, O_CLOEXEC); ++#else + fd = mkstemp(template); ++#endif + if (fd < 0) + return fd; + unlink(template);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707060302.v6632xK2056763>