+ p = out;
+ while (p) {
+ pend = strchr (p, '\n');
+ if (pend) {
+ *pend = '\0';
+ pend++;
+ }
+
+ /* Lines have the format:
+ * /dev/foo on /mountpoint type ...
+ */
+ p2 = strstr (p, " on /sysroot");
+ if (p2 != NULL) {
+ p2 += 4;
+ p3 = p2 + strcspn (p2, " ");
+ *p3 = '\0';
+ if (add_string (&mounts, &size, &alloc, p2) == -1) {
+ free (out);
+ return -1;
+ }
+ }
+
+ p = pend;
+ }
+ free (out);
+
+ qsort (mounts, size, sizeof (char *), compare_longest_first);
+
+ /* Unmount them. */
+ for (i = 0; i < size; ++i) {