aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-23 06:47:50 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-06-23 06:47:50 +0000
commitd55f9dce9f5f48f7a1a5e1c51ace5e2def59f46a (patch)
tree43849b2ff810693d6bf044ae75ad2f1a9d1aa5e6
parente69108e1161af269cc9edd73295e75182886a2a2 (diff)
downloadperl-URPM-d55f9dce9f5f48f7a1a5e1c51ace5e2def59f46a.tar
perl-URPM-d55f9dce9f5f48f7a1a5e1c51ace5e2def59f46a.tar.gz
perl-URPM-d55f9dce9f5f48f7a1a5e1c51ace5e2def59f46a.tar.bz2
perl-URPM-d55f9dce9f5f48f7a1a5e1c51ace5e2def59f46a.tar.xz
perl-URPM-d55f9dce9f5f48f7a1a5e1c51ace5e2def59f46a.zip
Clarify error message when a synthesis file can't be read or gunzipped
-rw-r--r--URPM.xs6
-rw-r--r--t/fatal.t2
2 files changed, 5 insertions, 3 deletions
diff --git a/URPM.xs b/URPM.xs
index 6f0be1b..7b18190 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -3326,9 +3326,11 @@ Urpm_parse_synthesis(urpm, filename, ...)
}
} else {
SV **nofatal = hv_fetch((HV*)SvRV(urpm), "nofatal", 7, 0);
- errno = ENOENT;
+ if (!errno) errno = EINVAL; /* zlib error */
if (!nofatal || !SvIV(*nofatal))
- croak("unable to uncompress synthesis file %s", filename);
+ croak(errno == ENOENT
+ ? "unable to read synthesis file %s"
+ : "unable to uncompress synthesis file %s", filename);
}
} else croak("first argument should contain a depslist ARRAY reference");
} else croak("first argument should be a reference to a HASH");
diff --git a/t/fatal.t b/t/fatal.t
index 5a98286..0cfeafa 100644
--- a/t/fatal.t
+++ b/t/fatal.t
@@ -10,7 +10,7 @@ eval { $u->parse_hdlist('non-existent'); };
like( $@, qr/^cannot open hdlist file non-existent/, 'fatal error on hdlist not found' );
is( $! + 0, $!{EBADF}, '$! is EBADF' );
eval { $u->parse_synthesis('non-existent'); };
-like( $@, qr/^unable to uncompress synthesis file non-existent/, 'fatal error on synthesis not found' );
+like( $@, qr/^unable to read synthesis file non-existent/, 'fatal error on synthesis not found' );
is( $! + 0, $!{ENOENT}, '$! is ENOENT' );
my $v = new URPM( nofatal => 1 );