summaryrefslogtreecommitdiffstats
path: root/sbin/mount/getmntopts.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/mount/getmntopts.c')
-rw-r--r--sbin/mount/getmntopts.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c
index f8a3453..59a383e 100644
--- a/sbin/mount/getmntopts.c
+++ b/sbin/mount/getmntopts.c
@@ -181,3 +181,17 @@ build_iovec_argf(struct iovec **iov, int *iovlen, const char *name,
va_end(ap);
build_iovec(iov, iovlen, name, strdup(val), (size_t)-1);
}
+
+/*
+ * Free the iovec and reset to NULL with zero length. Useful for calling
+ * nmount in a loop.
+ */
+void
+free_iovec(struct iovec **iov, int *iovlen)
+{
+ int i;
+
+ for (i = 0; i < *iovlen; i++)
+ free((*iov)[i].iov_base);
+ free(*iov);
+}
OpenPOWER on IntegriCloud