Re: libtool: handle fork() error

2018-08-27 Thread Marc Espie
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.pm11 Jul 2012 12:54:07 -  1.4
> +++ LT/Exec.pm26 Aug 2018 14:00:15 -
> @@ -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  na...@mips.inka.de

Okay, I actually had this in one of my trees, but forgot to commit it. :)



Re: libtool: handle fork() error

2018-08-26 Thread Jeremie Courreges-Anglas
On Sun, Aug 26 2018, 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?

ok jca@

> 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.pm11 Jul 2012 12:54:07 -  1.4
> +++ LT/Exec.pm26 Aug 2018 14:00:15 -
> @@ -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) {

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



libtool: handle fork() error

2018-08-26 Thread Christian Weisgerber
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 -  1.4
+++ LT/Exec.pm  26 Aug 2018 14:00:15 -
@@ -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  na...@mips.inka.de