diff options
author | John Southworth <john.southworth@vyatta.com> | 2012-05-10 18:18:17 -0700 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2012-05-10 18:18:17 -0700 |
commit | ec497dc1a54c88784b380200508eba6a85f4cb97 (patch) | |
tree | 7a8c02cf54ab18f9d8e2049dd8f5057105c0d694 /lib/Vyatta/Misc.pm | |
parent | e80a38f61e2321f0cde98f996e2c97dec2f389b6 (diff) | |
download | vyatta-cfg-ec497dc1a54c88784b380200508eba6a85f4cb97.tar.gz vyatta-cfg-ec497dc1a54c88784b380200508eba6a85f4cb97.zip |
Bugfix 8079: fix require sys/ioctl.ph confilcts
perl only allows a require to be done once. If it is done in two
included modules the module or function in the module used second
doesn't have the data in the required file in its scope. To prevent
this I created a third module that contains the functions that require
'sys/ioctl.ph' so that there is no longer a conflict.
Diffstat (limited to 'lib/Vyatta/Misc.pm')
-rwxr-xr-x | lib/Vyatta/Misc.pm | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/Vyatta/Misc.pm b/lib/Vyatta/Misc.pm index 61ce029..850cb2b 100755 --- a/lib/Vyatta/Misc.pm +++ b/lib/Vyatta/Misc.pm @@ -21,9 +21,9 @@ package Vyatta::Misc; use strict; +use Vyatta::ioctl; require Exporter; -require 'sys/ioctl.ph'; our @ISA = qw(Exporter); our @EXPORT = qw(getInterfaces getIP getNetAddIP get_sysfs_value @@ -527,14 +527,7 @@ sub interface_description { # returns (rows, columns) for terminal size sub get_terminal_size { - my $winsize = ''; - open(my $TTY, '>', '/dev/tty'); - # undefined if output not going to terminal - return unless (ioctl($TTY, &TIOCGWINSZ, $winsize)); - close($TTY); - - my ($rows, $cols, undef, undef) = unpack('S4', $winsize); - return ($rows, $cols); + return Vyatta::ioctl::get_terminal_size(); } # return only terminal width |