From 1d9f410810de6fbb9c974735e5e14dbebe1c0718 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 22 Jul 2016 12:43:22 +0300 Subject: Adapt to fdstream extension --- bpkg/rep-create.cxx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'bpkg/rep-create.cxx') diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index 61e3f81..16da164 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -5,9 +5,9 @@ #include #include -#include #include +#include #include // dir_iterator #include @@ -217,17 +217,15 @@ namespace bpkg try { { - ofstream ofs; - ofs.exceptions (ofstream::badbit | ofstream::failbit); - // While we can do nothing about repositories files edited on Windows // and littered with the carriage return characters, there is no // reason to litter the auto-generated packages and signature files. // - ofs.open (p.string (), ofstream::out | ofstream::binary); + ofdstream ofs (p, ios::binary); manifest_serializer s (ofs, p.string ()); manifests.serialize (s); + ofs.close (); } const optional& cert (rms.back ().certificate); @@ -245,12 +243,11 @@ namespace bpkg p = path (d / signature); - ofstream ofs; - ofs.exceptions (ofstream::badbit | ofstream::failbit); - ofs.open (p.string (), ofstream::out | ofstream::binary); + ofdstream ofs (p, ios::binary); manifest_serializer s (ofs, p.string ()); m.serialize (s); + ofs.close (); } else { @@ -266,9 +263,9 @@ namespace bpkg { fail << "unable to save manifest: " << e.description; } - catch (const ofstream::failure&) + catch (const ofdstream::failure& e) { - fail << "unable to write to " << p; + fail << "unable to write to " << p << ": " << e.what (); } if (verb) -- cgit v1.1