Re: Validation failed

victory <[email protected]>
Newsgroups gmane.linux.debian.devel.www
Message-ID <[email protected]>
On Mon, 09 Oct 2017 15:52:36 +0000
Debian Webmaster wrote:

> Calling POSIX::tmpnam() is deprecated at /srv/www.debian.org/cron/scripts/validate line 578

you guys should fix your scripts immediately instead of throwing useless mails repeatedly;
example patch below;

note: this is not tested in any way; 
	do not blindly apply to production; make sure to do test before that.

-- 
victory
no need to CC me :-)
--
diff --git a/scripts/validate b/scripts/validate
index 24f1f0a..7d20f1c 100755
--- a/scripts/validate
+++ b/scripts/validate
@@ -33,7 +33,7 @@
 use strict;
 use Getopt::Long qw(GetOptions);
 use Text::Wrap qw(wrap);
-use POSIX qw(:fcntl_h);
+use File::Temp;
 
 #####################################################################
 
@@ -573,12 +573,9 @@ sub superChomp {
 # Create temporary file securely
 # Returns the name and file handle of the created file
 sub getTempFile {
-    my $filename;
-    do {
-        $filename = POSIX::tmpnam();
-    } until sysopen(FH, $filename, O_RDWR|O_CREAT|O_EXCL, 0666);
-
-    return ($filename, \*FH);
+    my ($filename, $fh);
+    ($fh, $filename) = File::Temp::tempfile;
+    return ($filename, $fh);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.