From 3bdd22cf0cf94b4feb0646a45f64bc8c7abfc792 Mon Sep 17 00:00:00 2001 From: Bojan Petrovic Date: Wed, 25 May 2011 05:00:43 +0800 Subject: [PATCH 1/1] Circumvent buggy negation of assigned $!. Loopback fs fails to create a new file every other time on FreeBSD. This happens because of a Perl bug which occurs when $! is set from Perl (as in x_mknod()), and then negated after a failed syscall (as in x_getattr()). See http://www.perlmonks.org/?node_id=906466. --- examples/loopback_t.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/loopback_t.pl b/examples/loopback_t.pl index 0e72261..db03fb9 100755 --- a/examples/loopback_t.pl +++ b/examples/loopback_t.pl @@ -121,7 +121,7 @@ sub x_mknod { # and possibly run the real mknod command. my ($file, $modes, $dev) = @_; $file = fixup($file); - $! = 0; + undef $!; if ($^O eq 'freebsd') { if (S_ISREG($modes)) { open(FILE, '>', $file) || return -$!; -- 2.20.1