aboutsummaryrefslogtreecommitdiffstats
path: root/doc/genps.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2017-04-02 19:28:13 -0700
committerH. Peter Anvin <hpa@zytor.com>2017-04-02 19:36:41 -0700
commit841d904f88884f896735da1292e42615eaaea64f (patch)
tree141bb849caf87cb7387dd8e0f32d47348e7771a9 /doc/genps.pl
parentdd535a6d19d73c31878e461304d326a4c8631843 (diff)
downloadnasm-daily-841d904f88884f896735da1292e42615eaaea64f.tar.gz
nasm-daily-841d904f88884f896735da1292e42615eaaea64f.tar.xz
nasm-daily-841d904f88884f896735da1292e42615eaaea64f.zip
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/genps.pl')
-rwxr-xr-xdoc/genps.pl9
1 files changed, 4 insertions, 5 deletions
diff --git a/doc/genps.pl b/doc/genps.pl
index 86d10007..18918f93 100755
--- a/doc/genps.pl
+++ b/doc/genps.pl
@@ -39,8 +39,6 @@
require 'psfonts.ph'; # The fonts we want to use
require 'pswidth.ph'; # PostScript string width
-use Fcntl;
-
#
# PostScript configurables; these values are also available to the
# PostScript code itself
@@ -190,10 +188,11 @@ for ( $i = 0 ; $i < 256 ; $i++ ) {
# a cleaner representation
#
if ( defined($input) ) {
- sysopen(PARAS, $input, O_RDONLY) or
+ open(PARAS, '<', $input) or
die "$0: cannot open $input: $!\n";
} else {
- open(PARAS, "<&STDIN") or die "$0: $!\n";
+ # stdin
+ open(PARAS, '<-') or die "$0: $!\n";
}
while ( defined($line = <PARAS>) ) {
chomp $line;
@@ -1116,7 +1115,7 @@ print "sti show\n";
# and DocumentFonts in the header of the EPSF and add those to the
# global header.
if ( defined($metadata{epslogo}) &&
- sysopen(EPS, $metadata{epslogo}, O_RDONLY) ) {
+ open(EPS, '<', $metadata{epslogo}) ) {
my @eps = ();
my ($bbllx,$bblly,$bburx,$bbury) = (undef,undef,undef,undef);
my $line;