From: Jarkko Hietaniemi Date: Sun, 2 Apr 2006 21:57:19 +0000 (+0300) Subject: ext/IO/t/io_unix.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cb7854e0d24c05f046ed8804e19a25065a5cb06a;p=p5sagit%2Fp5-mst-13.2.git ext/IO/t/io_unix.t Message-ID: <44301E8F.2060503@gmail.com> p4raw-id: //depot/perl@27699 --- diff --git a/ext/IO/t/io_unix.t b/ext/IO/t/io_unix.t index 4eaf843..21b8a90 100644 --- a/ext/IO/t/io_unix.t +++ b/ext/IO/t/io_unix.t @@ -52,7 +52,26 @@ print "1..5\n"; use IO::Socket; -$listen = IO::Socket::UNIX->new(Local=>$PATH, Listen=>0) || die "$!"; +$listen = IO::Socket::UNIX->new(Local => $PATH, Listen => 0); + +# Sometimes UNIX filesystems are mounted for security reasons +# with "nodev" option which spells out "no" for creating UNIX +# local sockets. Therefore we will retry with a File::Temp +# generated filename from a temp directory. +unless (defined $listen) { + eval { require File::Temp }; + unless ($@) { + import File::Temp 'mktemp'; + for my $TMPDIR ($ENV{TMPDIR}, "/tmp") { + if (defined $TMPDIR && -d $TMPDIR && -w $TMPDIR) { + $PATH = mktemp("$TMPDIR/sXXXXXXXX"); + last if $listen = IO::Socket::UNIX->new(Local => $PATH, + Listen => 0); + } + } + } + defined $listen or die "$PATH: $!"; +} print "ok 1\n"; if($pid = fork()) {