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:
@@ -380,8 +380,8 @@ dhclient_start (NMDhcpClient *client,
|
||||
if (!success) {
|
||||
nm_log_warn (log_domain, "(%s): failed to save DUID to %s: (%d) %s.",
|
||||
iface, priv->lease_file,
|
||||
error ? error->code : -1,
|
||||
error && error->message ? error->message : "(unknown)");
|
||||
error->code,
|
||||
error->message);
|
||||
g_free (pid_file);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -591,8 +591,8 @@ get_duid (NMDhcpClient *client)
|
||||
if (error) {
|
||||
nm_log_warn (LOGD_DHCP, "Failed to read leasefile '%s': (%d) %s",
|
||||
priv->def_leasefile,
|
||||
error ? error->code : -1,
|
||||
error ? error->message : "(unknown)");
|
||||
error->code,
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user