---
daemon/daemon.h | 1 +
daemon/guestfsd.c | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/daemon/daemon.h b/daemon/daemon.h
index d3ba148..f2244b0 100644
--- a/daemon/daemon.h
+++ b/daemon/daemon.h
@@ -92,6 +92,7 @@ extern int add_string (struct stringsbuf *sb, const char *str);
extern int add_sprintf (struct stringsbuf *sb, const char *fs, ...)
__attribute__((format (printf,2,3)));
extern int end_stringsbuf (struct stringsbuf *sb);
+extern char **take_stringsbuf (struct stringsbuf *sb);
extern void free_stringsbuf (struct stringsbuf *sb);
extern size_t count_strings (char *const *argv);
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c
index a571aad..198b2b2 100644
--- a/daemon/guestfsd.c
+++ b/daemon/guestfsd.c
@@ -594,6 +594,18 @@ free_stringsbuf (struct stringsbuf *sb)
free_stringslen (sb->argv, sb->size);
}
+/* Take the ownership of the strings of the strings buffer,
+ * resetting it to a null buffer.
+ */
+char **
+take_stringsbuf (struct stringsbuf *sb)
+{
+ DECLARE_STRINGSBUF (null);
+ char **ret = sb->argv;
+ *sb = null;
+ return ret;
+}
+
size_t
count_strings (char *const *argv)
{
--
2.1.0