diff options
author | H. Peter Anvin <hpa@zytor.com> | 2017-04-02 19:28:13 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2017-04-02 19:36:41 -0700 |
commit | 841d904f88884f896735da1292e42615eaaea64f (patch) | |
tree | 141bb849caf87cb7387dd8e0f32d47348e7771a9 /doc/rdsrc.pl | |
parent | dd535a6d19d73c31878e461304d326a4c8631843 (diff) | |
download | nasm-841d904f88884f896735da1292e42615eaaea64f.tar.gz |
perl: change to the new, safer 3-operand form of open()
The 2-operand form was inherently unsafe. Use the 3-operand form
instead, which guarantees that arbitrary filenames are supported.
This also means we can remove a few instances of sysopen() which was
used for exactly this reason, however, at least in theory sysopen()
isn't portable.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'doc/rdsrc.pl')
-rw-r--r-- | doc/rdsrc.pl | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/doc/rdsrc.pl b/doc/rdsrc.pl index da9cf252..dedd35d3 100644 --- a/doc/rdsrc.pl +++ b/doc/rdsrc.pl @@ -541,7 +541,7 @@ sub indexsort { sub indexdiag { my $iitem,$ientry,$w,$ww,$foo,$node; - open INDEXDIAG,">index.diag"; + open INDEXDIAG,'>', 'index.diag'; foreach $iitem (@itags) { $ientry = $idxmap{$iitem}; print INDEXDIAG "<$iitem> "; @@ -593,7 +593,7 @@ sub write_txt { # Open file. print "writing file..."; - open TEXT,">nasmdoc.txt"; + open TEXT,'>', 'nasmdoc.txt'; select TEXT; # Preamble. @@ -724,7 +724,7 @@ sub write_html { # Write contents file. Just the preamble, then a menu of links to the # separate chapter files and the nodes therein. print "writing contents file..."; - open TEXT,">nasmdoc0.html"; + open TEXT,'>', 'nasmdoc0.html'; select TEXT; &html_preamble(0); print "<p>This manual documents NASM, the Netwide Assembler: an assembler\n"; @@ -759,7 +759,7 @@ sub write_html { # Open a null file, to ensure output (eg random &html_jumppoints calls) # goes _somewhere_. print "writing chapter files..."; - open TEXT,">/dev/null"; + open TEXT, '>', '/dev/null'; select TEXT; $html_lastf = ''; @@ -780,7 +780,7 @@ sub write_html { $html_lastf = $html_fnames{$chapternode}; $chapternode = $nodexrefs{$xref}; $html_nextf = $html_fnames{$tstruct_mnext{$chapternode}}; - open TEXT,">$html_fnames{$chapternode}"; select TEXT; &html_preamble(1); + open(TEXT, '>', $html_fnames{$chapternode}); select TEXT; &html_preamble(1); foreach $i (@$pname) { $ww = &word_html($i); $title .= $ww unless $ww eq "\001"; @@ -796,7 +796,7 @@ sub write_html { $html_lastf = $html_fnames{$chapternode}; $chapternode = $nodexrefs{$xref}; $html_nextf = $html_fnames{$tstruct_mnext{$chapternode}}; - open TEXT,">$html_fnames{$chapternode}"; select TEXT; &html_preamble(1); + open(TEXT, '>', $html_fnames{$chapternode}); select TEXT; &html_preamble(1); foreach $i (@$pname) { $ww = &word_html($i); $title .= $ww unless $ww eq "\001"; @@ -865,7 +865,7 @@ sub write_html { close TEXT; print "\n writing index file..."; - open TEXT,">nasmdoci.html"; + open TEXT,'>', 'nasmdoci.html'; select TEXT; &html_preamble(0); print "<p align=center><a href=\"nasmdoc0.html\">Contents</a>\n"; @@ -986,7 +986,7 @@ sub write_texi { # Open file. print "writing file..."; - open TEXT,">nasmdoc.texi"; + open TEXT,'>', 'nasmdoc.texi'; select TEXT; # Preamble. @@ -1252,7 +1252,7 @@ sub write_hlp { # Write the HPJ project-description file. print "writing .hpj file..."; - open HPJ,">nasmdoc.hpj"; + open HPJ,'>', 'nasmdoc.hpj'; print HPJ "[OPTIONS]\ncompress=true\n"; print HPJ "title=NASM: The Netwide Assembler\noldkeyphrase=no\n\n"; print HPJ "[FILES]\nnasmdoc.rtf\n\n"; @@ -1264,7 +1264,7 @@ sub write_hlp { # Open file. print "\n writing .rtf file..."; - open TEXT,">nasmdoc.rtf"; + open TEXT,'>', 'nasmdoc.rtf'; select TEXT; # Preamble. @@ -1514,7 +1514,7 @@ sub add_item { # by future backends, instead of putting it all in the same script. # sub write_dip { - open(PARAS, "> nasmdoc.dip"); + open(PARAS, '>', 'nasmdoc.dip'); foreach $k (sort(keys(%metadata))) { print PARAS 'meta :', $k, "\n"; print PARAS $metadata{$k},"\n"; |