What | Removed | Added |
---|---|---|
CC | 7eggert@gmx.de |
Partially tested patch: Also fixes unrelated write to a closed file handle --- /bin/html2ps.orig 2024-11-11 21:24:34.494394856 +0100 +++ /bin/html2ps 2024-11-11 22:30:02.293753109 +0100 @@ -357,6 +357,8 @@ EOR use POSIX; $posix = 1; +use File::Temp qw/ tempdir /; + %extend=('quote',1, 'font',1, 'colour',1, 'hyphenation',1); %fal=("serif","times", "sans_serif","helvetica", "monospace","courier"); @fo=("p","pre","h1","h2","h3","h4","h5","h6","i","b","tt","kbd","cite","samp", @@ -495,11 +497,9 @@ die "Ghostscript is required to generate if($opt_D && !$package{'Ghostscript'}); die "Ghostscript is required to generate cross references\n" if($opt_R && !$package{'Ghostscript'}); -$tmpname=$posix?POSIX::tmpnam():"h2p_$$"; -sysopen TMP, $tmpname, O_RDWR|O_CREAT|O_EXCL, 0600 or die "$!"; -close TMP; -($scr=$tmpname)=~/\w+$/; -$tempdir=$`; + +$tempdir = tempdir( CLEANUP => 1 ); +$scr = File::Temp::tempnam( $tempdir, "html2ps_" ); if($opt_u) {$ulanch="t"}; if(defined $opt_x && $opt_x!~/^[0-2]$/) { @@ -4517,6 +4517,7 @@ sub prompt { chop($_[1]=<STDIN>); } sub dbg { + return if !$opt_d; print STDERR $_[0]; print DBG $_[0]; }