dhcp: cache errno in nm_dhcp_client_stop_existing() before using it

This commit is contained in:
Thomas Haller 2018-05-25 15:41:39 +02:00
parent 181cf5c709
commit 5bd3f7bd67
2 changed files with 10 additions and 6 deletions

View file

@ -659,8 +659,10 @@ nm_dhcp_client_stop_existing (const char *pid_file, const char *binary_name)
out:
if (remove (pid_file) == -1) {
nm_log_dbg (LOGD_DHCP, "dhcp: could not remove pid file \"%s\": %d (%s)",
pid_file, errno, g_strerror (errno));
int errsv = errno;
nm_log_dbg (LOGD_DHCP, "dhcp: could not remove pid file \"%s\": %s (%d)",
pid_file, g_strerror (errsv), errsv);
}
}

View file

@ -545,10 +545,12 @@ stop (NMDhcpClient *client, gboolean release, GBytes *duid)
if (remove (priv->conf_file) == -1)
_LOGD ("could not remove dhcp config file \"%s\": %d (%s)", priv->conf_file, errno, g_strerror (errno));
if (priv->pid_file) {
if (remove (priv->pid_file) == -1)
_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errno, g_strerror (errno));
g_free (priv->pid_file);
priv->pid_file = NULL;
if (remove (priv->pid_file) == -1) {
int errsv = errno;
_LOGD ("could not remove dhcp pid file \"%s\": %s (%d)", priv->pid_file, g_strerror (errsv), errsv);
}
nm_clear_g_free (&priv->pid_file);
}
if (release) {