mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user