diff options
author | Tim Bunce <Tim.Bunce@ig.co.uk> | 1997-09-05 00:00:00 +0000 |
---|---|---|
committer | Tim Bunce <Tim.Bunce@ig.co.uk> | 1997-09-05 00:00:00 +0000 |
commit | 67693aa57fec51f6f6d1a25162537acf9a943624 (patch) | |
tree | 7f7099c099a029e94b76d73fc6a8edfbf958c41f /lib | |
parent | 63bfca455098588d6283c6105813307e3523e5b7 (diff) | |
download | perl-67693aa57fec51f6f6d1a25162537acf9a943624.tar.gz |
Sys::Hostname fails under Solaris 2.5 when setuid
(this is the same change as commit b6d5cd8ca8d16f83d5c4c7a0bc602634e3efb321, but as applied)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sys/Hostname.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Sys/Hostname.pm b/lib/Sys/Hostname.pm index d23310a5af..95f9a99a7a 100644 --- a/lib/Sys/Hostname.pm +++ b/lib/Sys/Hostname.pm @@ -78,6 +78,19 @@ sub hostname { syscall(&main::SYS_gethostname, $host, 65) == 0; } + # method 2a - syscall using systeminfo instead of gethostname + # -- needed on systems like Solaris + || eval { + local $SIG{__DIE__}; + { + package main; + require "sys/syscall.ph"; + require "sys/systeminfo.ph"; + } + $host = "\0" x 65; ## preload scalar + syscall(&main::SYS_systeminfo, &main::SI_HOSTNAME, $host, 65) != -1; + } + # method 3 - trusty old hostname command || eval { local $SIG{__DIE__}; |