diff options
-rw-r--r-- | URPM.xs | 6 | ||||
-rw-r--r-- | t/fatal.t | 2 |
2 files changed, 5 insertions, 3 deletions
@@ -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"); @@ -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 ); |