- if (mp) {
- p2 += 4 + sysroot_len; /* skip " on /sysroot" */
- len = strcspn (p2, " ");
-
- if (len == 0) /* .. just /sysroot, so we turn it into "/" */
- p2 = (char *) "/";
- else
- p2[len] = '\0';
-
- if (add_string (&ret, &size, &alloc, p2) == -1) {
- free (out);
- return NULL;
- }
- }
+ if (mp &&
+ add_string (&ret, &size, &alloc, "/") == -1)
+ goto error;
+ }
+ /* Or allow a mount directory like "/sysroot/...". */
+ if (STRPREFIX (m->mnt_dir, sysroot) && m->mnt_dir[sysroot_len] == '/') {
+ if (add_string (&ret, &size, &alloc, m->mnt_fsname) == -1)
+ goto error;
+ if (mp &&
+ add_string (&ret, &size, &alloc, &m->mnt_dir[sysroot_len]) == -1)
+ goto error;