all: clean-up usage of GError
Functions that take a GError** MUST fill it in on error. There is no need to check whether error is NULL if the function it was passed to had a failing return value. Likewise, a proper GError must have a non-NULL message, so there's no need to double-check that either. Based-on-patch-by: Dan Winship <danw@gnome.org>
This commit is contained in:
@@ -304,8 +304,7 @@ nm_act_request_set_shared (NMActRequest *req, gboolean shared)
|
||||
if (!g_spawn_sync ("/", argv, envp, G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,
|
||||
NULL, NULL, NULL, NULL, &status, &error)) {
|
||||
nm_log_warn (LOGD_SHARING, "Error executing command: (%d) %s",
|
||||
error ? error->code : -1,
|
||||
(error && error->message) ? error->message : "(unknown)");
|
||||
error->code, error->message);
|
||||
g_clear_error (&error);
|
||||
} else if (WEXITSTATUS (status)) {
|
||||
nm_log_warn (LOGD_SHARING, "** Command returned exit status %d.",
|
||||
|
Reference in New Issue
Block a user