develooper Front page | perl.perl5.porters | Postings from April 2014

[perl #121742] [PATCH] Coverity: safe umask before mkstemp

From:
Tony Cook via RT
Date:
April 28, 2014 01:47
Subject:
[perl #121742] [PATCH] Coverity: safe umask before mkstemp
Message ID:
rt-4.0.18-7175-1398649614-743.121742-15-0@perl.org
On Sat Apr 26 12:56:06 2014, jhi wrote:
> Use safe umask (0600) before mkstemp.   Modern glibcs use a safe umask, 
> but older ones don't, and on non-glibc systems better play safe.
> 
> Attached.

While I think the patch is good, threaded code that uses C<< open my $fh, "+>", undef >> might see some intermittent unexpected permissions on files created in other threads.

Unfortunately umask() updates the mask for the whole process and there's no thread-local variant, so I don't see a thread-safe solution.

Added to the 5.21.1 list.

Tony


---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=121742



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About