Check for error from some guestfs_set_* calls (found by Coverity).

For some guestfs_set_* calls, add checks for error, when error might
possibly occur.  eg. It's plausible that guestfs_set_network might
fail if the attach-method being used doesn't support it (although this
doesn't happen at the moment).

In other cases, don't check for errors, eg. if the error doesn't
matter or there's nothing we could plausibly do about it.
This commit is contained in:
Richard W.M. Jones
2012-12-08 13:09:29 +00:00
parent 8331d46384
commit 59b51274eb
3 changed files with 24 additions and 13 deletions

View File

@@ -219,9 +219,10 @@ main (int argc, char *argv[])
dir_cache_timeout = atoi (optarg);
else if (STREQ (long_options[option_index].name, "fuse-help"))
fuse_help ();
else if (STREQ (long_options[option_index].name, "selinux"))
guestfs_set_selinux (g, 1);
else if (STREQ (long_options[option_index].name, "format")) {
else if (STREQ (long_options[option_index].name, "selinux")) {
if (guestfs_set_selinux (g, 1) == -1)
exit (EXIT_FAILURE);
} else if (STREQ (long_options[option_index].name, "format")) {
if (!optarg || STREQ (optarg, ""))
format = NULL;
else
@@ -357,7 +358,8 @@ main (int argc, char *argv[])
}
/* If we're forking, we can't use the recovery process. */
guestfs_set_recovery_proc (g, !do_fork);
if (guestfs_set_recovery_proc (g, !do_fork) == -1)
exit (EXIT_FAILURE);
/* Do the guest drives and mountpoints. */
add_drives (drvs, 'a');