From f2a3f23acfba84595c9c24fcaebc349814d593ed Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Wed, 3 Oct 2018 07:29:50 +0200 Subject: [PATCH] Fix havemknod test "last" only exits the innermost block, thus we need a label. Since blocks are semantically the same as loops that only execute once, we also replace the while() with a single block. --- mmdebstrap | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index b5fde3a..91b8044 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -367,7 +367,7 @@ sub havemknod($) { if (-e "$root/test-dev-null") { die "/test-dev-null already exists"; } - while ($havemknod == 0) { + TEST: { # we fork so that we can read STDERR my $pid = open my $fh, '-|' // die "failed to fork(): $!"; if ($pid == 0) { @@ -379,10 +379,10 @@ sub havemknod($) { chomp (my $content = do { local $/; <$fh> }); close $fh; { - last unless $? == 0 and $content eq ''; - last unless -c "$root/test-dev-null"; - last unless open my $fh, '>', "$root/test-dev-null"; - last unless print $fh 'test'; + last TEST unless $? == 0 and $content eq ''; + last TEST unless -c "$root/test-dev-null"; + last TEST unless open my $fh, '>', "$root/test-dev-null"; + last TEST unless print $fh 'test'; } $havemknod = 1; }