Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Feb 1996 00:00:29 +0100 (MET)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        CVS-committers@freefall.freebsd.org, cvs-gnu@freefall.freebsd.org
Subject:   Re: cvs commit: src/gnu/usr.bin/perl/lib gethostname.pl Makefile
Message-ID:  <199602132300.AAA06395@uriah.heep.sax.de>
In-Reply-To: <199602131750.KAA22891@rocky.sri.MT.net> from "Nate Williams" at Feb 13, 96 10:50:27 am

next in thread | previous in thread | raw e-mail | index | archive | help
As Nate Williams wrote:
> 
> Paul Traina writes:
> > This is non-standard (albiet nice to have), which will make porting away
> > from FBSD more difficult.  Caveat Emptor.
> 
> Unless you bring in the package with anything exported from FreeBSD.

The problem is that there's no generic way for hooking gethostname(3)
into a Perl script.

I rather consider this an omission of Perl.  Anyway, the simple
solution:

------8<-----8<-----8<-----8<-----8<-----
package gethostname;

sub gethostname {
    return `hostname`;
}

1;
------8<-----8<-----8<-----8<-----8<-----

should always do the trick.  My concern was to avoid the overhead from
the additional process, and the fact that i don't like to call
unneeded external programs at all in setuid scripts.

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602132300.AAA06395>