Commit 047998f8 authored by Thomas Haller's avatar Thomas Haller

all: cache errno in local variable before using it

parent b7bb7449
...@@ -1426,19 +1426,20 @@ pager_fallback (void) ...@@ -1426,19 +1426,20 @@ pager_fallback (void)
{ {
char buf[64]; char buf[64];
int rb; int rb;
int errsv;
do { do {
rb = read (STDIN_FILENO, buf, sizeof (buf)); rb = read (STDIN_FILENO, buf, sizeof (buf));
if (rb == -1) { if (rb == -1) {
if (errno == EINTR) { errsv = errno;
if (errsv == EINTR)
continue; continue;
} else { g_printerr (_("Error reading nmcli output: %s\n"), strerror (errsv));
g_printerr (_("Error reading nmcli output: %s\n"), strerror (errno)); _exit(EXIT_FAILURE);
_exit(EXIT_FAILURE);
}
} }
if (write (STDOUT_FILENO, buf, rb) == -1) { if (write (STDOUT_FILENO, buf, rb) == -1) {
g_printerr (_("Error writing nmcli output: %s\n"), strerror (errno)); errsv = errno;
g_printerr (_("Error writing nmcli output: %s\n"), strerror (errsv));
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} }
} while (rb > 0); } while (rb > 0);
...@@ -1453,6 +1454,7 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config) ...@@ -1453,6 +1454,7 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config)
pid_t pager_pid; pid_t pager_pid;
pid_t parent_pid; pid_t parent_pid;
int fd[2]; int fd[2];
int errsv;
if ( nmc_config->in_editor if ( nmc_config->in_editor
|| nmc_config->print_output == NMC_PRINT_TERSE || nmc_config->print_output == NMC_PRINT_TERSE
...@@ -1462,7 +1464,8 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config) ...@@ -1462,7 +1464,8 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config)
return 0; return 0;
if (pipe (fd) == -1) { if (pipe (fd) == -1) {
g_printerr (_("Failed to create pager pipe: %s\n"), strerror (errno)); errsv = errno;
g_printerr (_("Failed to create pager pipe: %s\n"), strerror (errsv));
return 0; return 0;
} }
...@@ -1470,7 +1473,8 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config) ...@@ -1470,7 +1473,8 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config)
pager_pid = fork (); pager_pid = fork ();
if (pager_pid == -1) { if (pager_pid == -1) {
g_printerr (_("Failed to fork pager: %s\n"), strerror (errno)); errsv = errno;
g_printerr (_("Failed to fork pager: %s\n"), strerror (errsv));
nm_close (fd[0]); nm_close (fd[0]);
nm_close (fd[1]); nm_close (fd[1]);
return 0; return 0;
...@@ -1515,10 +1519,14 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config) ...@@ -1515,10 +1519,14 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config)
} }
/* Return in the parent */ /* Return in the parent */
if (dup2 (fd[1], STDOUT_FILENO) < 0) if (dup2 (fd[1], STDOUT_FILENO) < 0) {
g_printerr (_("Failed to duplicate pager pipe: %s\n"), strerror (errno)); errsv = errno;
if (dup2 (fd[1], STDERR_FILENO) < 0) g_printerr (_("Failed to duplicate pager pipe: %s\n"), strerror (errsv));
g_printerr (_("Failed to duplicate pager pipe: %s\n"), strerror (errno)); }
if (dup2 (fd[1], STDERR_FILENO) < 0) {
errsv = errno;
g_printerr (_("Failed to duplicate pager pipe: %s\n"), strerror (errsv));
}
nm_close (fd[0]); nm_close (fd[0]);
nm_close (fd[1]); nm_close (fd[1]);
......
...@@ -82,7 +82,6 @@ nm_vpn_plugin_utils_read_vpn_details (int fd, ...@@ -82,7 +82,6 @@ nm_vpn_plugin_utils_read_vpn_details (int fd,
ssize_t nr; ssize_t nr;
GHashTable *hash = NULL; GHashTable *hash = NULL;
errno = 0;
nr = read (fd, &c, 1); nr = read (fd, &c, 1);
if (nr == -1) { if (nr == -1) {
if (errno == EAGAIN) { if (errno == EAGAIN) {
......
...@@ -807,7 +807,6 @@ nm_vpn_service_plugin_read_vpn_details (int fd, ...@@ -807,7 +807,6 @@ nm_vpn_service_plugin_read_vpn_details (int fd,
while (1) { while (1) {
ssize_t nr; ssize_t nr;
errno = 0;
nr = read (fd, &c, 1); nr = read (fd, &c, 1);
if (nr < 0) { if (nr < 0) {
if (errno == EAGAIN) { if (errno == EAGAIN) {
......
...@@ -36,10 +36,11 @@ _nm_printf (3, 4) ...@@ -36,10 +36,11 @@ _nm_printf (3, 4)
static int static int
_get_contents_error (GError **error, int errsv, const char *format, ...) _get_contents_error (GError **error, int errsv, const char *format, ...)
{ {
if (errsv < 0) if (errsv < 0) {
errsv = -errsv; errsv = errsv == G_MININT
else if (!errsv) ? G_MAXINT
errsv = errno; : -errsv;
}
if (error) { if (error) {
char *msg; char *msg;
...@@ -57,6 +58,12 @@ _get_contents_error (GError **error, int errsv, const char *format, ...) ...@@ -57,6 +58,12 @@ _get_contents_error (GError **error, int errsv, const char *format, ...)
} }
return -errsv; return -errsv;
} }
#define _get_contents_error_errno(error, ...) \
({ \
int _errsv = (errno); \
\
_get_contents_error (error, _errsv, __VA_ARGS__); \
})
static char * static char *
_mem_realloc (char *old, gboolean do_bzero_mem, gsize cur_len, gsize new_len) _mem_realloc (char *old, gboolean do_bzero_mem, gsize cur_len, gsize new_len)
...@@ -127,13 +134,14 @@ nm_utils_fd_get_contents (int fd, ...@@ -127,13 +134,14 @@ nm_utils_fd_get_contents (int fd,
struct stat stat_buf; struct stat stat_buf;
gs_free char *str = NULL; gs_free char *str = NULL;
const bool do_bzero_mem = NM_FLAGS_HAS (flags, NM_UTILS_FILE_GET_CONTENTS_FLAG_SECRET); const bool do_bzero_mem = NM_FLAGS_HAS (flags, NM_UTILS_FILE_GET_CONTENTS_FLAG_SECRET);
int errsv;
g_return_val_if_fail (fd >= 0, -EINVAL); g_return_val_if_fail (fd >= 0, -EINVAL);
g_return_val_if_fail (contents, -EINVAL); g_return_val_if_fail (contents, -EINVAL);
g_return_val_if_fail (!error || !*error, -EINVAL); g_return_val_if_fail (!error || !*error, -EINVAL);
if (fstat (fd, &stat_buf) < 0) if (fstat (fd, &stat_buf) < 0)
return _get_contents_error (error, 0, "failure during fstat"); return _get_contents_error_errno (error, "failure during fstat");
if (!max_length) { if (!max_length) {
/* default to a very large size, but not extreme */ /* default to a very large size, but not extreme */
...@@ -156,7 +164,7 @@ nm_utils_fd_get_contents (int fd, ...@@ -156,7 +164,7 @@ nm_utils_fd_get_contents (int fd,
if (n_read < 0) { if (n_read < 0) {
if (do_bzero_mem) if (do_bzero_mem)
nm_explicit_bzero (str, n_stat); nm_explicit_bzero (str, n_stat);
return _get_contents_error (error, n_read, "error reading %zu bytes from file descriptor", n_stat); return _get_contents_error (error, -n_read, "error reading %zu bytes from file descriptor", n_stat);
} }
str[n_read] = '\0'; str[n_read] = '\0';
...@@ -176,19 +184,19 @@ nm_utils_fd_get_contents (int fd, ...@@ -176,19 +184,19 @@ nm_utils_fd_get_contents (int fd,
else { else {
fd2 = fcntl (fd, F_DUPFD_CLOEXEC, 0); fd2 = fcntl (fd, F_DUPFD_CLOEXEC, 0);
if (fd2 < 0) if (fd2 < 0)
return _get_contents_error (error, 0, "error during dup"); return _get_contents_error_errno (error, "error during dup");
} }
if (!(f = fdopen (fd2, "r"))) { if (!(f = fdopen (fd2, "r"))) {
errsv = errno;
nm_close (fd2); nm_close (fd2);
return _get_contents_error (error, 0, "failure during fdopen"); return _get_contents_error (error, errsv, "failure during fdopen");
} }
n_have = 0; n_have = 0;
n_alloc = 0; n_alloc = 0;
while (!feof (f)) { while (!feof (f)) {
int errsv;
gsize n_read; gsize n_read;
n_read = fread (buf, 1, sizeof (buf), f); n_read = fread (buf, 1, sizeof (buf), f);
...@@ -395,20 +403,21 @@ nm_utils_file_set_contents (const char *filename, ...@@ -395,20 +403,21 @@ nm_utils_file_set_contents (const char *filename,
* guarantee the data is written to the disk before the metadata.) * guarantee the data is written to the disk before the metadata.)
*/ */
if ( lstat (filename, &statbuf) == 0 if ( lstat (filename, &statbuf) == 0
&& statbuf.st_size > 0 && statbuf.st_size > 0) {
&& fsync (fd) != 0) { if (fsync (fd) != 0) {
errsv = errno; errsv = errno;
nm_close (fd); nm_close (fd);
unlink (tmp_name); unlink (tmp_name);
g_set_error (error, g_set_error (error,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errsv), g_file_error_from_errno (errsv),
"failed to fsync %s: %s", "failed to fsync %s: %s",
tmp_name, tmp_name,
g_strerror (errsv)); g_strerror (errsv));
return FALSE; return FALSE;
}
} }
nm_close (fd); nm_close (fd);
......
...@@ -1769,10 +1769,12 @@ nm_utils_fd_read_loop (int fd, void *buf, size_t nbytes, bool do_poll) ...@@ -1769,10 +1769,12 @@ nm_utils_fd_read_loop (int fd, void *buf, size_t nbytes, bool do_poll)
k = read (fd, p, nbytes); k = read (fd, p, nbytes);
if (k < 0) { if (k < 0) {
if (errno == EINTR) int errsv = errno;
if (errsv == EINTR)
continue; continue;
if (errno == EAGAIN && do_poll) { if (errsv == EAGAIN && do_poll) {
/* We knowingly ignore any return value here, /* We knowingly ignore any return value here,
* and expect that any error/EOF is reported * and expect that any error/EOF is reported
...@@ -1782,7 +1784,7 @@ nm_utils_fd_read_loop (int fd, void *buf, size_t nbytes, bool do_poll) ...@@ -1782,7 +1784,7 @@ nm_utils_fd_read_loop (int fd, void *buf, size_t nbytes, bool do_poll)
continue; continue;
} }
return n > 0 ? n : -errno; return n > 0 ? n : -errsv;
} }
if (k == 0) if (k == 0)
......
...@@ -369,8 +369,8 @@ br2684_create_iface (NMDeviceAdsl *self, ...@@ -369,8 +369,8 @@ br2684_create_iface (NMDeviceAdsl *self,
priv->nas_update_id = g_timeout_add (100, nas_update_cb, self); priv->nas_update_id = g_timeout_add (100, nas_update_cb, self);
return NM_ACT_STAGE_RETURN_POSTPONE; return NM_ACT_STAGE_RETURN_POSTPONE;
} }
if (errno != EEXIST) { errsv = errno;
errsv = errno; if (errsv != EEXIST) {
_LOGW (LOGD_ADSL, "failed to create br2684 interface (%d)", errsv); _LOGW (LOGD_ADSL, "failed to create br2684 interface (%d)", errsv);
break; break;
} }
......
...@@ -56,6 +56,7 @@ dun_connect (NMBluez5DunContext *context) ...@@ -56,6 +56,7 @@ dun_connect (NMBluez5DunContext *context)
char tty[100]; char tty[100];
const int ttylen = sizeof (tty) - 1; const int ttylen = sizeof (tty) - 1;
GError *error = NULL; GError *error = NULL;
int errsv;
struct rfcomm_dev_req req = { struct rfcomm_dev_req req = {
.flags = (1 << RFCOMM_REUSE_DLC) | (1 << RFCOMM_RELEASE_ONHUP), .flags = (1 << RFCOMM_REUSE_DLC) | (1 << RFCOMM_RELEASE_ONHUP),
...@@ -65,7 +66,7 @@ dun_connect (NMBluez5DunContext *context) ...@@ -65,7 +66,7 @@ dun_connect (NMBluez5DunContext *context)
context->rfcomm_fd = socket (AF_BLUETOOTH, SOCK_STREAM | SOCK_CLOEXEC, BTPROTO_RFCOMM); context->rfcomm_fd = socket (AF_BLUETOOTH, SOCK_STREAM | SOCK_CLOEXEC, BTPROTO_RFCOMM);
if (context->rfcomm_fd < 0) { if (context->rfcomm_fd < 0) {
int errsv = errno; errsv = errno;
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED, error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Failed to create RFCOMM socket: (%d) %s", "Failed to create RFCOMM socket: (%d) %s",
errsv, strerror (errsv)); errsv, strerror (errsv));
...@@ -77,7 +78,7 @@ dun_connect (NMBluez5DunContext *context) ...@@ -77,7 +78,7 @@ dun_connect (NMBluez5DunContext *context)
sa.rc_channel = 0; sa.rc_channel = 0;
memcpy (&sa.rc_bdaddr, &context->src, ETH_ALEN); memcpy (&sa.rc_bdaddr, &context->src, ETH_ALEN);
if (bind (context->rfcomm_fd, (struct sockaddr *) &sa, sizeof(sa))) { if (bind (context->rfcomm_fd, (struct sockaddr *) &sa, sizeof(sa))) {
int errsv = errno; errsv = errno;
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED, error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Failed to bind socket: (%d) %s", "Failed to bind socket: (%d) %s",
errsv, strerror (errsv)); errsv, strerror (errsv));
...@@ -87,7 +88,7 @@ dun_connect (NMBluez5DunContext *context) ...@@ -87,7 +88,7 @@ dun_connect (NMBluez5DunContext *context)
sa.rc_channel = context->rfcomm_channel; sa.rc_channel = context->rfcomm_channel;
memcpy (&sa.rc_bdaddr, &context->dst, ETH_ALEN); memcpy (&sa.rc_bdaddr, &context->dst, ETH_ALEN);
if (connect (context->rfcomm_fd, (struct sockaddr *) &sa, sizeof (sa)) ) { if (connect (context->rfcomm_fd, (struct sockaddr *) &sa, sizeof (sa)) ) {
int errsv = errno; errsv = errno;
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED, error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Failed to connect to remote device: (%d) %s", "Failed to connect to remote device: (%d) %s",
errsv, strerror (errsv)); errsv, strerror (errsv));
...@@ -102,7 +103,7 @@ dun_connect (NMBluez5DunContext *context) ...@@ -102,7 +103,7 @@ dun_connect (NMBluez5DunContext *context)
memcpy (&req.dst, &context->dst, ETH_ALEN); memcpy (&req.dst, &context->dst, ETH_ALEN);
devid = ioctl (context->rfcomm_fd, RFCOMMCREATEDEV, &req); devid = ioctl (context->rfcomm_fd, RFCOMMCREATEDEV, &req);
if (devid < 0) { if (devid < 0) {
int errsv = errno; errsv = errno;
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED, error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Failed to create rfcomm device: (%d) %s", "Failed to create rfcomm device: (%d) %s",
errsv, strerror (errsv)); errsv, strerror (errsv));
...@@ -249,7 +250,8 @@ sdp_connect_watch (GIOChannel *channel, GIOCondition condition, gpointer user_da ...@@ -249,7 +250,8 @@ sdp_connect_watch (GIOChannel *channel, GIOCondition condition, gpointer user_da
sdp_list_t *search, *attrs; sdp_list_t *search, *attrs;
uuid_t svclass; uuid_t svclass;
uint16_t attr; uint16_t attr;
int fd, err, fd_err = 0; int fd, fd_err = 0;
int err;
socklen_t len = sizeof (fd_err); socklen_t len = sizeof (fd_err);
GError *error = NULL; GError *error = NULL;
...@@ -257,13 +259,13 @@ sdp_connect_watch (GIOChannel *channel, GIOCondition condition, gpointer user_da ...@@ -257,13 +259,13 @@ sdp_connect_watch (GIOChannel *channel, GIOCondition condition, gpointer user_da
fd = g_io_channel_unix_get_fd (channel); fd = g_io_channel_unix_get_fd (channel);
if (getsockopt (fd, SOL_SOCKET, SO_ERROR, &fd_err, &len) < 0) { if (getsockopt (fd, SOL_SOCKET, SO_ERROR, &fd_err, &len) < 0) {
nm_log_dbg (LOGD_BT, "(%s -> %s): getsockopt error=%d",
context->src_str, context->dst_str, errno);
err = errno; err = errno;
nm_log_dbg (LOGD_BT, "(%s -> %s): getsockopt error=%d",
context->src_str, context->dst_str, err);
} else { } else {
err = fd_err;
nm_log_dbg (LOGD_BT, "(%s -> %s): SO_ERROR error=%d", nm_log_dbg (LOGD_BT, "(%s -> %s): SO_ERROR error=%d",
context->src_str, context->dst_str, fd_err); context->src_str, context->dst_str, fd_err);
err = fd_err;
} }
if (err != 0) { if (err != 0) {
......
...@@ -136,6 +136,7 @@ agent_dbus_method_cb (GDBusConnection *connection, ...@@ -136,6 +136,7 @@ agent_dbus_method_cb (GDBusConnection *connection,
int ifindex; int ifindex;
NMDevice *device; NMDevice *device;
gs_free char *name_owner = NULL; gs_free char *name_owner = NULL;
int errsv;
/* Be paranoid and check the sender address */ /* Be paranoid and check the sender address */
name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (priv->object_manager)); name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (priv->object_manager));
...@@ -171,8 +172,9 @@ agent_dbus_method_cb (GDBusConnection *connection, ...@@ -171,8 +172,9 @@ agent_dbus_method_cb (GDBusConnection *connection,
ifindex = if_nametoindex (ifname); ifindex = if_nametoindex (ifname);
if (!ifindex) { if (!ifindex) {
errsv = errno;
_LOGD ("agent-request: if_nametoindex failed for Name %s for Device at %s: %i", _LOGD ("agent-request: if_nametoindex failed for Name %s for Device at %s: %i",
ifname, device_path, errno); ifname, device_path, errsv);
goto return_error; goto return_error;
} }
...@@ -338,6 +340,7 @@ set_device_dbus_object (NMIwdManager *self, GDBusProxy *proxy, ...@@ -338,6 +340,7 @@ set_device_dbus_object (NMIwdManager *self, GDBusProxy *proxy,
const char *ifname; const char *ifname;
int ifindex; int ifindex;
NMDevice *device; NMDevice *device;
int errsv;
ifname = get_property_string_or_null (proxy, "Name"); ifname = get_property_string_or_null (proxy, "Name");
if (!ifname) { if (!ifname) {
...@@ -349,8 +352,9 @@ set_device_dbus_object (NMIwdManager *self, GDBusProxy *proxy, ...@@ -349,8 +352,9 @@ set_device_dbus_object (NMIwdManager *self, GDBusProxy *proxy,
ifindex = if_nametoindex (ifname); ifindex = if_nametoindex (ifname);
if (!ifindex) { if (!ifindex) {
errsv = errno;
_LOGE ("if_nametoindex failed for Name %s for Device at %s: %i", _LOGE ("if_nametoindex failed for Name %s for Device at %s: %i",
ifname, g_dbus_proxy_get_object_path (proxy), errno); ifname, g_dbus_proxy_get_object_path (proxy), errsv);
return; return;
} }
......
...@@ -591,16 +591,18 @@ stop (NMDhcpClient *client, gboolean release) ...@@ -591,16 +591,18 @@ stop (NMDhcpClient *client, gboolean release)
{ {
NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client); NMDhcpDhclient *self = NM_DHCP_DHCLIENT (client);
NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self); NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE (self);
int errsv;
NM_DHCP_CLIENT_CLASS (nm_dhcp_dhclient_parent_class)->stop (client, release); NM_DHCP_CLIENT_CLASS (nm_dhcp_dhclient_parent_class)->stop (client, release);
if (priv->conf_file) if (priv->conf_file)
if (remove (priv->conf_file) == -1) if (remove (priv->conf_file) == -1) {
_LOGD ("could not remove dhcp config file \"%s\": %d (%s)", priv->conf_file, errno, g_strerror (errno)); errsv = errno;
_LOGD ("could not remove dhcp config file \"%s\": %d (%s)", priv->conf_file, errsv, g_strerror (errsv));
}
if (priv->pid_file) { if (priv->pid_file) {
if (remove (priv->pid_file) == -1) { if (remove (priv->pid_file) == -1) {
int errsv = errno; errsv = errno;
_LOGD ("could not remove dhcp pid file \"%s\": %s (%d)", priv->pid_file, g_strerror (errsv), errsv); _LOGD ("could not remove dhcp pid file \"%s\": %s (%d)", priv->pid_file, g_strerror (errsv), errsv);
} }
nm_clear_g_free (&priv->pid_file); nm_clear_g_free (&priv->pid_file);
......
...@@ -203,12 +203,15 @@ stop (NMDhcpClient *client, gboolean release) ...@@ -203,12 +203,15 @@ stop (NMDhcpClient *client, gboolean release)
{ {
NMDhcpDhcpcanon *self = NM_DHCP_DHCPCANON (client); NMDhcpDhcpcanon *self = NM_DHCP_DHCPCANON (client);
NMDhcpDhcpcanonPrivate *priv = NM_DHCP_DHCPCANON_GET_PRIVATE (self); NMDhcpDhcpcanonPrivate *priv = NM_DHCP_DHCPCANON_GET_PRIVATE (self);
int errsv;
NM_DHCP_CLIENT_CLASS (nm_dhcp_dhcpcanon_parent_class)->stop (client, release); NM_DHCP_CLIENT_CLASS (nm_dhcp_dhcpcanon_parent_class)->stop (client, release);
if (priv->pid_file) { if (priv->pid_file) {
if (remove (priv->pid_file) == -1) if (remove (priv->pid_file) == -1) {
_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errno, g_strerror (errno)); errsv = errno;
_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errsv, g_strerror (errsv));
}
g_free (priv->pid_file); g_free (priv->pid_file);
priv->pid_file = NULL; priv->pid_file = NULL;
} }
......
...@@ -197,12 +197,15 @@ stop (NMDhcpClient *client, gboolean release) ...@@ -197,12 +197,15 @@ stop (NMDhcpClient *client, gboolean release)
{ {
NMDhcpDhcpcd *self = NM_DHCP_DHCPCD (client); NMDhcpDhcpcd *self = NM_DHCP_DHCPCD (client);
NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (self); NMDhcpDhcpcdPrivate *priv = NM_DHCP_DHCPCD_GET_PRIVATE (self);
int errsv;
NM_DHCP_CLIENT_CLASS (nm_dhcp_dhcpcd_parent_class)->stop (client, release); NM_DHCP_CLIENT_CLASS (nm_dhcp_dhcpcd_parent_class)->stop (client, release);
if (priv->pid_file) { if (priv->pid_file) {
if (remove (priv->pid_file) == -1) if (remove (priv->pid_file) == -1) {
_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errno, g_strerror (errno)); errsv = errno;
_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errsv, g_strerror (errsv));
}
} }
/* FIXME: implement release... */ /* FIXME: implement release... */
......
...@@ -544,7 +544,7 @@ nm_dhcp_utils_ip4_config_from_options (NMDedupMultiIndex *multi_idx, ...@@ -544,7 +544,7 @@ nm_dhcp_utils_ip4_config_from_options (NMDedupMultiIndex *multi_idx,
errno = 0; errno = 0;
int_mtu = strtol (str, NULL, 10); int_mtu = strtol (str, NULL, 10);
if ((errno == EINVAL) || (errno == ERANGE)) if (NM_IN_SET (errno, EINVAL, ERANGE))
goto error; goto error;
if (int_mtu > 576) if (int_mtu > 576)
......
...@@ -535,6 +535,7 @@ dispatch_netconfig (NMDnsManager *self, ...@@ -535,6 +535,7 @@ dispatch_netconfig (NMDnsManager *self,
{