diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-02-01 16:38:22 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-02-01 16:38:22 +0000 |
commit | 12cd28413051f1a7467fda8fd7c6f5af106e62da (patch) | |
tree | 1ec64f609e775e19b4b97ee76fea1c452d829fe0 /usr.bin | |
parent | 6590428ed3993f81f7696307fa275789505da1f3 (diff) |
handle errors reading .pc files in --list gracefully.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/pkg-config/pkg-config | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config index 42fa1b012a3..6dedc57e5f1 100644 --- a/usr.bin/pkg-config/pkg-config +++ b/usr.bin/pkg-config/pkg-config @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $OpenBSD: pkg-config,v 1.19 2006/12/16 17:14:34 espie Exp $ +# $OpenBSD: pkg-config,v 1.20 2007/02/01 16:38:21 espie Exp $ #$CSK: pkgconfig.pl,v 1.39 2006/11/27 16:26:20 ckuethe Exp $ # Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org> @@ -423,6 +423,8 @@ sub do_libs sub do_list { my ($p, $x, $y, @files, $fname, $name); + my $error = 0; + foreach my $p (@PKGPATH) { push(@files, <$p/*.pc>); } @@ -439,12 +441,17 @@ sub do_list foreach my $f (@files) { my $cfg = get_config($f); + if (!defined $cfg) { + print STDERR "Problem reading file $f\n"; + $error = 1; + next; + } $fname = basename($f, '.pc'); printf("%${x}s %s - %s\n", $fname, stringize($cfg->get_property('Name', $variables)), stringize($cfg->get_property('Description', $variables))); } - return 0; + return $error; } sub help |