aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bbot/worker/worker.cxx32
1 files changed, 30 insertions, 2 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index 5415a9a..4f3e5ad 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -306,10 +306,11 @@ static void
upload_manifest (tracer& trace,
const string& url,
const T& m,
- const char* what)
+ const string& what)
{
try
{
+#if 0
tftp_curl c (trace,
path ("-"),
nullfd,
@@ -320,8 +321,35 @@ upload_manifest (tracer& trace,
manifest_serializer s (c.out, url);
m.serialize (s);
-
c.out.close ();
+#else
+ auto_rmfile tmp;
+ try
+ {
+ tmp = auto_rmfile (path::temp_path (what + "-manifest"));
+ ofdstream ofs (tmp.path);
+ manifest_serializer s (ofs, tmp.path.string ());
+ m.serialize (s);
+ ofs.close ();
+ }
+ catch (const io_error& e) // In case not derived from system_error.
+ {
+ fail << "unable to save " << what << " manifest: " << e;
+ }
+ catch (const system_error& e)
+ {
+ fail << "unable to save " << what << " manifest: " << e;
+ }
+
+ tftp_curl c (trace,
+ tmp.path,
+ nullfd,
+ curl::put,
+ url,
+ "--tftp-blksize", tftp_blksize,
+ "--max-time", tftp_put_timeout);
+#endif
+
if (!c.wait ())
throw_generic_ios_failure (EIO, "non-zero curl exit code");
}