summaryrefslogtreecommitdiffstats
path: root/fuse/guestmount.c
diff options
context:
space:
mode:
Diffstat (limited to 'fuse/guestmount.c')
-rw-r--r--fuse/guestmount.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/fuse/guestmount.c b/fuse/guestmount.c
index 2fe56ca4..b6c64671 100644
--- a/fuse/guestmount.c
+++ b/fuse/guestmount.c
@@ -42,6 +42,37 @@
#include "guestmount.h"
#include "options.h"
+#ifndef HAVE_FUSE_OPT_ADD_OPT_ESCAPED
+/* Copied from lib/fuse_opt.c and modified.
+ * Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
+ * This [function] can be distributed under the terms of the GNU LGPLv2.
+ */
+static int
+fuse_opt_add_opt_escaped (char **opts, const char *opt)
+{
+ unsigned oldlen = *opts ? strlen(*opts) : 0;
+ char *d = realloc (*opts, oldlen + 1 + strlen(opt) * 2 + 1);
+
+ if (!d) {
+ perror ("realloc");
+ exit (EXIT_FAILURE);
+ }
+
+ *opts = d;
+ if (oldlen) {
+ d += oldlen;
+ *d++ = ',';
+ }
+
+ for (; *opt; opt++) {
+ if (*opt == ',' || *opt == '\\')
+ *d++ = '\\';
+ *d++ = *opt;
+ }
+ *d = '\0';
+}
+#endif
+
guestfs_h *g = NULL;
int read_only = 0;
int live = 0;