On Sun, Aug 26, 2018 at 04:13:11PM +0200, Christian Weisgerber wrote:
> I noticed this curious error in a package bulk build:
> Use of uninitialized value $pid in numeric eq (==) at
> /usr/libdata/perl5/LT/Exec.pm line 96.
>
> Perl's fork() wrapper returns undef rather than -1 on error.
> Handle this correctly. OK?
>
> Index: LT/Exec.pm
> ===================================================================
> RCS file: /cvs/src/usr.bin/libtool/LT/Exec.pm,v
> retrieving revision 1.4
> diff -u -p -r1.4 Exec.pm
> --- LT/Exec.pm 11 Jul 2012 12:54:07 -0000 1.4
> +++ LT/Exec.pm 26 Aug 2018 14:00:15 -0000
> @@ -93,7 +93,7 @@ sub command_run
> }
> tsay { "@l" };
> my $pid = fork();
> - if ($pid == -1) {
> + if (!defined $pid) {
> die "Couldn't fork while running @l\n";
> }
> if ($pid == 0) {
> --
> Christian "naddy" Weisgerber [email protected]
Okay, I actually had this in one of my trees, but forgot to commit it. :)