From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16273 invoked from network); 4 Jan 2022 22:31:46 -0000 Received: from 4ess.inri.net (216.126.196.42) by inbox.vuxu.org with ESMTPUTF8; 4 Jan 2022 22:31:46 -0000 Received: from odoacer.turtle-trading.net ([93.241.193.16]) by 4ess; Tue Jan 4 15:27:02 -0500 2022 Received: from zenobia.turtle-trading.net ([192.168.2.111]) by odoacer.turtle-trading.net with esmtp (Exim 4.80) (envelope-from ) id 1n4pkM-0003jM-3m; Tue, 04 Jan 2022 20:45:26 +0100 Received: from benny by zenobia.turtle-trading.net with local (Exim 4.94.2) (envelope-from ) id 1n4pkL-000gE7-Rs; Tue, 04 Jan 2022 20:45:25 +0100 From: Benjamin Riefenstahl To: 9front@9front.org Date: Tue, 04 Jan 2022 20:45:25 +0100 Message-ID: <8735m34756.fsf@turtle-trading.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: leveraged HTML over WEB2.0 NoSQL pipelining framework Subject: [9front] ape/mkstemp: Fix flags Reply-To: 9front@9front.org Precedence: bulk --=-=-= Content-Type: text/plain Tcl tries to use mkstemp() but the current implementation in APE does not allow reading from the file. This sets the flags to open() as documented in various man pages. Other implementations also check errno==EEXIST after failure, to break the loop earlier. But that is probably overkill for that rare error condition. --=-=-= Content-Type: multipart/mixed; boundary="upas-pqoitgezmhklhgytuwblmznwzh" Content-Disposition: inline This is a multi-part message in MIME format. --upas-pqoitgezmhklhgytuwblmznwzh Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit from postmaster@4ess: The following attachment had content that we can't prove to be harmless. To avoid possible automatic execution, we changed the content headers. The original header was: Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ape-mkstemp-better-options.patch --upas-pqoitgezmhklhgytuwblmznwzh Content-Type: application/octet-stream Content-Disposition: attachment; filename="0001-ape-mkstemp-better-options.patch.suspect" From: Benjamin Riefenstahl Date: Fri, 10 Dec 2021 20:44:26 +0000 Subject: [PATCH] ape/mkstemp: better options Use O_EXCL and make the file descriptor writeable. This is more usefull and it conforms to Single Unix and other specs. --- diff 3568e27ec8774a212564c8d2bf6b3d9a19d4d571 9a027a77a0d407d542dbb49be398a474b10deb2b --- a/sys/src/ape/lib/ap/gen/mkstemp.c Tue Jan 4 01:19:36 2022 +++ b/sys/src/ape/lib/ap/gen/mkstemp.c Fri Dec 10 21:44:26 2021 @@ -1,6 +1,7 @@ #include #include #include +#include int mkstemp(char *template) @@ -14,7 +15,7 @@ for(i=0; i<20; i++){ strcpy(s, template); mktemp(s); - if((fd = creat(s, 0666)) >= 0){ + if((fd = open(s, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0){ strcpy(template, s); free(s); return fd; -- 1.0 --upas-pqoitgezmhklhgytuwblmznwzh-- --=-=-=--