[Libguestfs] [PATCH 5/5] inspect: gather info from /usr filesystems as well (RHBZ#1401474)
Richard W.M. Jones
rjones at redhat.com
Wed Dec 7 08:32:24 UTC 2016
On Tue, Dec 06, 2016 at 04:29:22PM +0100, Pino Toscano wrote:
> +static void
> +collect_linux_inspection_info_for (guestfs_h *g, struct inspect_fs *root)
> +{
> + size_t i;
> + struct inspect_fs *usr = NULL;
> +
> + for (i = 0; i < g->nr_fses; ++i) {
> + struct inspect_fs *fs = &g->fses[i];
> + size_t j;
> +
> + if (!(fs->distro == root->distro || fs->distro == OS_DISTRO_UNKNOWN) ||
> + fs->role != OS_ROLE_USR)
> + continue;
> +
> + for (j = 0; j < root->nr_fstab; ++j) {
> + if (STREQ (fs->mountable, root->fstab[j].mountable)) {
> + usr = fs;
> + goto got_usr;
> + }
> + }
> + }
> +
> + if (usr == NULL)
I think this should be:
assert (usr == NULL);
unless there's some way to reach this point and usr != NULL.
> + return;
> +
> + got_usr:
> + /* If the version information in /usr is not null, then most probably
> + * there was an os-release file there, so reset what is in root
> + * and pick the results from /usr.
> + */
> + if (!version_is_null (&usr->version)) {
> + root->distro = OS_DISTRO_UNKNOWN;
> + free (root->product_name);
> + root->product_name = NULL;
> + }
> +
> + guestfs_int_merge_fs_inspections (g, root, usr);
> +}
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
More information about the Libguestfs
mailing list