aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/misc.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dirmngr/misc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/dirmngr/misc.c b/dirmngr/misc.c
index 53d0099d2..93f051c1a 100644
--- a/dirmngr/misc.c
+++ b/dirmngr/misc.c
@@ -619,3 +619,21 @@ armor_data (char **r_string, const void *data, size_t datalen)
*r_string = buffer;
return 0;
}
+
+/* Copy all data from IN to OUT. */
+gpg_error_t
+copy_stream (estream_t in, estream_t out)
+{
+ char buffer[512];
+ size_t nread;
+
+ while (!es_read (in, buffer, sizeof buffer, &nread))
+ {
+ if (!nread)
+ return 0; /* EOF */
+ if (es_write (out, buffer, nread, NULL))
+ break;
+
+ }
+ return gpg_error_from_syserror ();
+}