aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-verify.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-07-22 12:43:22 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-07-23 20:06:50 +0300
commit1d9f410810de6fbb9c974735e5e14dbebe1c0718 (patch)
treef44b04d9e0a13a21deb7f59f1a2ae8334daf7f94 /bpkg/pkg-verify.cxx
parent7ea82c5013ab3c3d44b4b85cf767559e7019854f (diff)
Adapt to fdstream extension
Diffstat (limited to 'bpkg/pkg-verify.cxx')
-rw-r--r--bpkg/pkg-verify.cxx26
1 files changed, 4 insertions, 22 deletions
diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx
index 3c79cbd..ea072d9 100644
--- a/bpkg/pkg-verify.cxx
+++ b/bpkg/pkg-verify.cxx
@@ -4,8 +4,6 @@
#include <bpkg/pkg-verify>
-#include <fstream>
-
#include <butl/process>
#include <butl/fdstream>
@@ -38,11 +36,9 @@ namespace bpkg
//
process pr (start_extract (co, af, mf, diag));
- ifdstream is (pr.in_ofd);
- is.exceptions (ifdstream::badbit | ifdstream::failbit);
-
try
{
+ ifdstream is (pr.in_ofd, fdstream_mode::skip);
manifest_parser mp (is, mf.string ());
package_manifest m (mp, iu);
is.close ();
@@ -73,15 +69,6 @@ namespace bpkg
//
catch (const manifest_parsing& e)
{
- // Before we used to just close the file descriptor to signal to the
- // other end that we are not interested in the rest. But tar doesn't
- // take this very well (SIGPIPE). So now we are going to skip until
- // the end.
- //
- if (!is.eof ())
- is.ignore (numeric_limits<streamsize>::max ());
- is.close ();
-
if (pr.wait ())
{
if (diag)
@@ -93,8 +80,6 @@ namespace bpkg
}
catch (const ifdstream::failure&)
{
- is.close ();
-
if (pr.wait ())
{
if (diag)
@@ -144,10 +129,7 @@ namespace bpkg
try
{
- ifstream ifs;
- ifs.exceptions (ifstream::badbit | ifstream::failbit);
- ifs.open (mf.string ());
-
+ ifdstream ifs (mf);
manifest_parser mp (ifs, mf.string ());
package_manifest m (mp, iu);
@@ -175,10 +157,10 @@ namespace bpkg
throw failed ();
}
- catch (const ifstream::failure&)
+ catch (const ifdstream::failure& e)
{
if (diag)
- error << "unable to read from " << mf;
+ error << "unable to read from " << mf << ": " << e.what ();
throw failed ();
}