Commit a4fb6ddf authored by Thomas Haller's avatar Thomas Haller

all: replace g_strerror() calls with nm_strerror_native()

parent 737ab514
......@@ -50,7 +50,7 @@ _get_contents_error (GError **error, int errsv, const char *format, ...)
G_FILE_ERROR,
g_file_error_from_errno (errsv),
"%s: %s",
msg, g_strerror (errsv));
msg, nm_strerror_native (errsv));
g_free (msg);
}
return -errsv;
......@@ -302,7 +302,7 @@ nm_utils_file_get_contents (int dirfd,
g_file_error_from_errno (errsv),
"Failed to open file \"%s\" with openat: %s",
filename,
g_strerror (errsv));
nm_strerror_native (errsv));
return -NM_ERRNO_NATIVE (errsv);
}
} else {
......@@ -315,7 +315,7 @@ nm_utils_file_get_contents (int dirfd,
g_file_error_from_errno (errsv),
"Failed to open file \"%s\": %s",
filename,
g_strerror (errsv));
nm_strerror_native (errsv));
return -NM_ERRNO_NATIVE (errsv);
}
}
......@@ -364,7 +364,7 @@ nm_utils_file_set_contents (const char *filename,
g_file_error_from_errno (errsv),
"failed to create file %s: %s",
tmp_name,
g_strerror (errsv));
nm_strerror_native (errsv));
return FALSE;
}
......@@ -383,7 +383,7 @@ nm_utils_file_set_contents (const char *filename,
g_file_error_from_errno (errsv),
"failed to write to file %s: %s",
tmp_name,
g_strerror (errsv));
nm_strerror_native (errsv));
return FALSE;
}
......@@ -412,7 +412,7 @@ nm_utils_file_set_contents (const char *filename,
g_file_error_from_errno (errsv),
"failed to fsync %s: %s",
tmp_name,
g_strerror (errsv));
nm_strerror_native (errsv));
return FALSE;
}
}
......@@ -428,7 +428,7 @@ nm_utils_file_set_contents (const char *filename,
"failed to rename %s to %s: %s",
tmp_name,
filename,
g_strerror (errsv));
nm_strerror_native (errsv));
return FALSE;
}
......
......@@ -705,7 +705,7 @@ nm_utils_error_set_literal (GError **error, int error_code, const char *literal)
NM_UTILS_ERROR_UNKNOWN, \
fmt, \
##__VA_ARGS__, \
g_strerror (({ \
nm_strerror_native (({ \
const int _errsv = (errsv); \
\
( _errsv >= 0 \
......
......@@ -99,7 +99,7 @@ static const char *
acd_error_to_string (int error)
{
if (error < 0)
return g_strerror (-error);
return nm_strerror_native (-error);
switch (error) {
case _N_ACD_E_SUCCESS:
......
......@@ -10172,9 +10172,9 @@ share_init (NMDevice *self, GError **error)
} else if (!nm_platform_sysctl_set (nm_device_get_platform (self), NMP_SYSCTL_PATHID_ABSOLUTE ("/proc/sys/net/ipv4/ip_forward"), "1")) {
errsv = errno;
_LOGD (LOGD_SHARING, "share: error enabling IPv4 forwarding: (%d) %s",
errsv, g_strerror (errsv));
errsv, nm_strerror_native (errsv));
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"cannot set ipv4/ip_forward: %s", g_strerror (errsv));
"cannot set ipv4/ip_forward: %s", nm_strerror_native (errsv));
return FALSE;
}
......
......@@ -383,7 +383,7 @@ lldp_neighbor_new (sd_lldp_neighbor *neighbor_sd, GError **error)
&chassis_id, &chassis_id_len);
if (r < 0) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"failed reading chassis-id: %s", g_strerror (-r));
"failed reading chassis-id: %s", nm_strerror_native (-r));
return NULL;
}
if (chassis_id_len < 1) {
......@@ -396,7 +396,7 @@ lldp_neighbor_new (sd_lldp_neighbor *neighbor_sd, GError **error)
&port_id, &port_id_len);
if (r < 0) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"failed reading port-id: %s", g_strerror (-r));
"failed reading port-id: %s", nm_strerror_native (-r));
return NULL;
}
if (port_id_len < 1) {
......@@ -412,7 +412,7 @@ lldp_neighbor_new (sd_lldp_neighbor *neighbor_sd, GError **error)
r = sd_lldp_neighbor_get_destination_address (neighbor_sd, &neigh->destination_address);
if (r < 0) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"failed getting destination address: %s", g_strerror (-r));
"failed getting destination address: %s", nm_strerror_native (-r));
goto out;
}
......@@ -463,7 +463,7 @@ lldp_neighbor_new (sd_lldp_neighbor *neighbor_sd, GError **error)
r = sd_lldp_neighbor_tlv_rewind (neighbor_sd);
if (r < 0) {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"failed reading tlv (rewind): %s", g_strerror (-r));
"failed reading tlv (rewind): %s", nm_strerror_native (-r));
goto out;
}
do {
......@@ -475,7 +475,7 @@ lldp_neighbor_new (sd_lldp_neighbor *neighbor_sd, GError **error)
if (r == -ENXIO)
continue;
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"failed reading tlv: %s", g_strerror (-r));
"failed reading tlv: %s", nm_strerror_native (-r));
goto out;
}
......
......@@ -625,7 +625,7 @@ out:
int errsv = errno;
nm_log_dbg (LOGD_DHCP, "dhcp: could not remove pid file \"%s\": %s (%d)",
pid_file, g_strerror (errsv), errsv);
pid_file, nm_strerror_native (errsv), errsv);
}
}
......
......@@ -598,12 +598,12 @@ stop (NMDhcpClient *client, gboolean release)
if (priv->conf_file)
if (remove (priv->conf_file) == -1) {
errsv = errno;
_LOGD ("could not remove dhcp config file \"%s\": %d (%s)", priv->conf_file, errsv, g_strerror (errsv));
_LOGD ("could not remove dhcp config file \"%s\": %d (%s)", priv->conf_file, errsv, nm_strerror_native (errsv));
}
if (priv->pid_file) {
if (remove (priv->pid_file) == -1) {
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, nm_strerror_native (errsv), errsv);
}
nm_clear_g_free (&priv->pid_file);
}
......
......@@ -210,7 +210,7 @@ stop (NMDhcpClient *client, gboolean release)
if (priv->pid_file) {
if (remove (priv->pid_file) == -1) {
errsv = errno;
_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errsv, g_strerror (errsv));
_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errsv, nm_strerror_native (errsv));
}
g_free (priv->pid_file);
priv->pid_file = NULL;
......
......@@ -204,7 +204,7 @@ stop (NMDhcpClient *client, gboolean release)
if (priv->pid_file) {
if (remove (priv->pid_file) == -1) {
errsv = errno;
_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errsv, g_strerror (errsv));
_LOGD ("could not remove dhcp pid file \"%s\": %d (%s)", priv->pid_file, errsv, nm_strerror_native (errsv));
}
}
......
......@@ -677,7 +677,7 @@ write_resolv_conf_contents (FILE *f,
NM_MANAGER_ERROR,
NM_MANAGER_ERROR_FAILED,
"Could not write " _PATH_RESCONF ": %s",
g_strerror (errsv));
nm_strerror_native (errsv));
errno = errsv;
return FALSE;
}
......@@ -749,7 +749,7 @@ dispatch_resolvconf (NMDnsManager *self,
NM_MANAGER_ERROR_FAILED,
"Could not write to %s: %s",
RESOLVCONF_PATH,
g_strerror (errsv));
nm_strerror_native (errsv));
return SR_ERROR;
}
......@@ -887,9 +887,9 @@ update_resolv_conf (NMDnsManager *self,
NM_MANAGER_ERROR_FAILED,
"Could not open %s: %s",
MY_RESOLV_CONF_TMP,
g_strerror (errsv));
nm_strerror_native (errsv));
_LOGT ("update-resolv-conf: open temporary file %s failed (%s)",
MY_RESOLV_CONF_TMP, g_strerror (errsv));
MY_RESOLV_CONF_TMP, nm_strerror_native (errsv));
return SR_ERROR;
}
......@@ -897,7 +897,7 @@ update_resolv_conf (NMDnsManager *self,
if (!success) {
errsv = errno;
_LOGT ("update-resolv-conf: write temporary file %s failed (%s)",
MY_RESOLV_CONF_TMP, g_strerror (errsv));
MY_RESOLV_CONF_TMP, nm_strerror_native (errsv));
}
if (fclose (f) < 0) {
......@@ -911,9 +911,9 @@ update_resolv_conf (NMDnsManager *self,
NM_MANAGER_ERROR_FAILED,
"Could not close %s: %s",
MY_RESOLV_CONF_TMP,
g_strerror (errsv));
nm_strerror_native (errsv));
_LOGT ("update-resolv-conf: close temporary file %s failed (%s)",
MY_RESOLV_CONF_TMP, g_strerror (errsv));
MY_RESOLV_CONF_TMP, nm_strerror_native (errsv));
}
return SR_ERROR;
} else if (!success)
......@@ -926,9 +926,9 @@ update_resolv_conf (NMDnsManager *self,
NM_MANAGER_ERROR_FAILED,
"Could not replace %s: %s",
MY_RESOLV_CONF,
g_strerror (errsv));
nm_strerror_native (errsv));
_LOGT ("update-resolv-conf: failed to rename temporary file %s to %s (%s)",
MY_RESOLV_CONF_TMP, MY_RESOLV_CONF, g_strerror (errsv));
MY_RESOLV_CONF_TMP, MY_RESOLV_CONF, nm_strerror_native (errsv));
return SR_ERROR;
}
......@@ -963,10 +963,10 @@ update_resolv_conf (NMDnsManager *self,
NM_MANAGER_ERROR_FAILED,
"Could not unlink %s: %s",
RESOLV_CONF_TMP,
g_strerror (errsv));
nm_strerror_native (errsv));
_LOGT ("update-resolv-conf: write internal file %s succeeded "
"but canot delete temporary file %s: %s",
MY_RESOLV_CONF, RESOLV_CONF_TMP, g_strerror (errsv));
MY_RESOLV_CONF, RESOLV_CONF_TMP, nm_strerror_native (errsv));
return SR_ERROR;
}
......@@ -978,10 +978,10 @@ update_resolv_conf (NMDnsManager *self,
"Could not create symlink %s pointing to %s: %s",
RESOLV_CONF_TMP,
MY_RESOLV_CONF,
g_strerror (errsv));
nm_strerror_native (errsv));
_LOGT ("update-resolv-conf: write internal file %s succeeded "
"but failed to symlink %s: %s",
MY_RESOLV_CONF, RESOLV_CONF_TMP, g_strerror (errsv));
MY_RESOLV_CONF, RESOLV_CONF_TMP, nm_strerror_native (errsv));
return SR_ERROR;
}
......@@ -993,10 +993,10 @@ update_resolv_conf (NMDnsManager *self,
"Could not rename %s to %s: %s",
RESOLV_CONF_TMP,
_PATH_RESCONF,
g_strerror (errsv));
nm_strerror_native (errsv));
_LOGT ("update-resolv-conf: write internal file %s succeeded "
"but failed to rename temporary symlink %s to %s: %s",
MY_RESOLV_CONF, RESOLV_CONF_TMP, _PATH_RESCONF, g_strerror (errsv));
MY_RESOLV_CONF, RESOLV_CONF_TMP, _PATH_RESCONF, nm_strerror_native (errsv));
return SR_ERROR;
}
......
......@@ -130,13 +130,13 @@ nm_main_utils_ensure_statedir ()
&& parent[1] != '\0'
&& g_mkdir_with_parents (parent, 0755) != 0) {
errsv = errno;
fprintf (stderr, "Cannot create parents for '%s': %s", NMSTATEDIR, g_strerror (errsv));
fprintf (stderr, "Cannot create parents for '%s': %s", NMSTATEDIR, nm_strerror_native (errsv));
exit (1);
}
/* Ensure state directory exists */
if (g_mkdir_with_parents (NMSTATEDIR, 0700) != 0) {
errsv = errno;
fprintf (stderr, "Cannot create '%s': %s", NMSTATEDIR, g_strerror (errsv));
fprintf (stderr, "Cannot create '%s': %s", NMSTATEDIR, nm_strerror_native (errsv));
exit (1);
}
}
......@@ -149,7 +149,7 @@ nm_main_utils_ensure_rundir ()
/* Setup runtime directory */
if (g_mkdir_with_parents (NMRUNDIR, 0755) != 0) {
errsv = errno;
fprintf (stderr, _("Cannot create '%s': %s"), NMRUNDIR, g_strerror (errsv));
fprintf (stderr, _("Cannot create '%s': %s"), NMRUNDIR, nm_strerror_native (errsv));
exit (1);
}
......@@ -160,7 +160,7 @@ nm_main_utils_ensure_rundir ()
if (g_mkdir (NM_CONFIG_DEVICE_STATE_DIR, 0755) != 0) {
errsv = errno;
if (errsv != EEXIST) {
fprintf (stderr, _("Cannot create '%s': %s"), NM_CONFIG_DEVICE_STATE_DIR, g_strerror (errsv));
fprintf (stderr, _("Cannot create '%s': %s"), NM_CONFIG_DEVICE_STATE_DIR, nm_strerror_native (errsv));
exit (1);
}
}
......
......@@ -334,7 +334,7 @@ main (int argc, char *argv[])
if (daemon (0, 0) < 0) {
errsv = errno;
fprintf (stderr, _("Could not daemonize: %s [error %u]\n"),
g_strerror (errsv),
nm_strerror_native (errsv),
errsv);
exit (1);
}
......
......@@ -84,7 +84,7 @@ send_rs (NMNDisc *ndisc, GError **error)
errsv = nm_errno_native (errsv);
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"%s (%d)",
g_strerror (errsv), errsv);
nm_strerror_native (errsv), errsv);
return FALSE;
}
......@@ -469,7 +469,7 @@ send_ra (NMNDisc *ndisc, GError **error)
errsv = nm_errno_native (errsv);
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"%s (%d)",
g_strerror (errsv), errsv);
nm_strerror_native (errsv), errsv);
return FALSE;
}
......@@ -600,7 +600,7 @@ nm_lndp_ndisc_new (NMPlatform *platform,
errsv = nm_errno_native (errsv);
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"failure creating libndp socket: %s (%d)",
g_strerror (errsv), errsv);
nm_strerror_native (errsv), errsv);
g_object_unref (ndisc);
return NULL;
}
......
......@@ -452,7 +452,7 @@ main (int argc, char *argv[])
if (daemon (0, 0) < 0) {
errsv = errno;
fprintf (stderr, _("Could not daemonize: %s [error %u]\n"),
g_strerror (errsv),
nm_strerror_native (errsv),
errsv);
return 1;
}
......
......@@ -7220,7 +7220,7 @@ rfkill_change (NMManager *self, const char *desc, RfKillType rtype, gboolean ena
if (len < 0) {
errsv = errno;
_LOGW (LOGD_RFKILL, "rfkill: (%s): failed to change Wi-Fi killswitch state: (%d) %s",
desc, errsv, g_strerror (errsv));
desc, errsv, nm_strerror_native (errsv));
} else if (len == sizeof (event)) {
_LOGI (LOGD_RFKILL, "rfkill: %s hardware radio set %s",
desc, enabled ? "enabled" : "disabled");
......
......@@ -554,7 +554,7 @@ _get_hostname (NMPolicy *self)
if (gethostname (hostname, HOST_NAME_BUFSIZE -1) != 0) {
errsv = errno;
_LOGT (LOGD_DNS, "get-hostname: couldn't get the system hostname: (%d) %s",
errsv, g_strerror (errsv));
errsv, nm_strerror_native (errsv));
g_free (hostname);
return NULL;
}
......
......@@ -459,7 +459,7 @@ G_DEFINE_TYPE (NMLinuxPlatform, nm_linux_platform, NM_TYPE_PLATFORM)
_LOG_print (__level, __domain, __errsv, self, \
_NM_UTILS_MACRO_FIRST (__VA_ARGS__) ": %s (%d)" \
_NM_UTILS_MACRO_REST (__VA_ARGS__), \
g_strerror (__errsv), __errsv); \
nm_strerror_native (__errsv), __errsv); \
} \
} G_STMT_END
......@@ -510,7 +510,7 @@ wait_for_nl_response_to_string (WaitForNlResponseResult seq_result,
if (seq_result < 0) {
nm_utils_strbuf_append (&buf, &buf_size, "failure %d (%s%s%s)",
-((int) seq_result),
g_strerror (-((int) seq_result)),
nm_strerror_native (-((int) seq_result)),
errmsg ? " - " : "",
errmsg ?: "");
}
......@@ -5055,7 +5055,7 @@ again:
errsv = errno;
if (errsv == EINTR && try_count++ < 100)
goto again;
_LOGD ("netlink: nl-send-nlmsghdr: failed sending message: %s (%d)", g_strerror (errsv), errsv);
_LOGD ("netlink: nl-send-nlmsghdr: failed sending message: %s (%d)", nm_strerror_native (errsv), errsv);
return -nm_errno_from_native (errsv);
}
}
......@@ -7580,7 +7580,7 @@ ip_route_get (NMPlatform *platform,
nle = _nl_send_nlmsghdr (platform, &req.n, &seq_result, NULL, DELAYED_ACTION_RESPONSE_TYPE_ROUTE_GET, &route);
if (nle < 0) {
_LOGE ("get-route: failure sending netlink request \"%s\" (%d)",
g_strerror (-nle), -nle);
nm_strerror_native (-nle), -nle);
return -NME_UNSPEC;
}
......
......@@ -181,7 +181,7 @@ ethtool_call_ifindex (int ifindex, gpointer edata)
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failed creating ethtool socket: %s",
ifindex,
_ethtool_data_to_string (edata, sbuf, sizeof (sbuf)),
g_strerror (-r));
nm_strerror_native (-r));
return r;
}
......@@ -487,7 +487,7 @@ nmp_utils_ethtool_get_features (int ifindex)
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failed creating ethtool socket: %s",
ifindex,
"get-features",
g_strerror (-r));
nm_strerror_native (-r));
return FALSE;
}
......@@ -618,7 +618,7 @@ nmp_utils_ethtool_set_features (int ifindex,
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failed creating ethtool socket: %s",
ifindex,
"set-features",
g_strerror (-r));
nm_strerror_native (-r));
return FALSE;
}
......@@ -654,7 +654,7 @@ nmp_utils_ethtool_set_features (int ifindex,
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failure setting features (%s)",
ifindex,
"set-features",
g_strerror (-r));
nm_strerror_native (-r));
return FALSE;
}
......@@ -764,7 +764,7 @@ nmp_utils_ethtool_supports_vlans (int ifindex)
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failed creating ethtool socket: %s",
ifindex,
"support-vlans",
g_strerror (-r));
nm_strerror_native (-r));
return FALSE;
}
......@@ -803,7 +803,7 @@ nmp_utils_ethtool_get_peer_ifindex (int ifindex)
nm_log_trace (LOGD_PLATFORM, "ethtool[%d]: %s: failed creating ethtool socket: %s",
ifindex,
"get-peer-ifindex",
g_strerror (-r));
nm_strerror_native (-r));
return FALSE;
}
......@@ -1050,7 +1050,7 @@ nmp_utils_mii_supports_carrier_detect (int ifindex)
if ((r = socket_handle_init (&shandle, ifindex)) < 0) {
nm_log_trace (LOGD_PLATFORM, "mii[%d]: carrier-detect no: failed creating ethtool socket: %s",
ifindex,
g_strerror (-r));
nm_strerror_native (-r));
return FALSE;
}
......
......@@ -332,7 +332,7 @@ _netns_new (GError **error)
errsv = errno;
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"Failed opening netns: %s",
g_strerror (errsv));
nm_strerror_native (errsv));
errno = errsv;
return NULL;
}
......@@ -342,7 +342,7 @@ _netns_new (GError **error)
errsv = errno;
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
"Failed opening mntns: %s",
g_strerror (errsv));
nm_strerror_native (errsv));
nm_close (fd_net);
errno = errsv;
return NULL;
......@@ -385,14 +385,14 @@ _netns_switch_push (GArray *netns_stack,
&& !_stack_current_ns_types (netns_stack, self, CLONE_NEWNET)
&& _setns (self, CLONE_NEWNET) != 0) {
errsv = errno;
_LOGE (self, "failed to switch netns: %s", g_strerror (errsv));
_LOGE (self, "failed to switch netns: %s", nm_strerror_native (errsv));
return FALSE;
}
if ( NM_FLAGS_HAS (ns_types, CLONE_NEWNS)
&& !_stack_current_ns_types (netns_stack, self, CLONE_NEWNS)
&& _setns (self, CLONE_NEWNS) != 0) {
errsv = errno;
_LOGE (self, "failed to switch mntns: %s", g_strerror (errsv));
_LOGE (self, "failed to switch mntns: %s", nm_strerror_native (errsv));
/* try to fix the mess by returning to the previous netns. */
if ( NM_FLAGS_HAS (ns_types, CLONE_NEWNET)
......@@ -401,7 +401,7 @@ _netns_switch_push (GArray *netns_stack,
if ( self
&& _setns (self, CLONE_NEWNET) != 0) {
errsv = errno;
_LOGE (self, "failed to restore netns: %s", g_strerror (errsv));
_LOGE (self, "failed to restore netns: %s", nm_strerror_native (errsv));
}
}
return FALSE;
......@@ -428,7 +428,7 @@ _netns_switch_pop (GArray *netns_stack,
success = FALSE;
} else if (_setns (current, CLONE_NEWNET) != 0) {
errsv = errno;
_LOGE (self, "failed to switch netns: %s", g_strerror (errsv));
_LOGE (self, "failed to switch netns: %s", nm_strerror_native (errsv));
success = FALSE;
}
}
......@@ -440,7 +440,7 @@ _netns_switch_pop (GArray *netns_stack,
success = FALSE;
} else if (_setns (current, CLONE_NEWNS) != 0) {
errsv = errno;
_LOGE (self, "failed to switch mntns: %s", g_strerror (errsv));
_LOGE (self, "failed to switch mntns: %s", nm_strerror_native (errsv));
success = FALSE;
}
}
......@@ -534,19 +534,19 @@ nmp_netns_new (void)
if (unshare (_CLONE_NS_ALL) != 0) {
errsv = errno;
_LOGE (NULL, "failed to create new net and mnt namespace: %s", g_strerror (errsv));
_LOGE (NULL, "failed to create new net and mnt namespace: %s", nm_strerror_native (errsv));
return NULL;
}
if (mount ("", "/", "none", MS_SLAVE | MS_REC, NULL) != 0) {
errsv = errno;
_LOGE (NULL, "failed mount --make-rslave: %s", g_strerror (errsv));
_LOGE (NULL, "failed mount --make-rslave: %s", nm_strerror_native (errsv));
goto err_out;
}
if (umount2 ("/sys", MNT_DETACH) != 0) {
errsv = errno;
_LOGE (NULL, "failed umount /sys: %s", g_strerror (errsv));
_LOGE (NULL, "failed umount /sys: %s", nm_strerror_native (errsv));
goto err_out;
}
......@@ -555,7 +555,7 @@ nmp_netns_new (void)
if (mount ("sysfs", "/sys", "sysfs", mountflags, NULL) != 0) {
errsv = errno;
_LOGE (NULL, "failed mount /sys: %s", g_strerror (errsv));
_LOGE (NULL, "failed mount /sys: %s", nm_strerror_native (errsv));
goto err_out;
}
......@@ -653,7 +653,7 @@ nmp_netns_bind_to_path (NMPNetns *self, const char *filename, int *out_fd)
errsv = errno;
if (errsv != EEXIST) {
_LOGE (self, "bind: failed to create directory %s: %s",
dirname, g_strerror (errsv));
dirname, nm_strerror_native (errsv));
return FALSE;
}
}
......@@ -661,7 +661,7 @@ nmp_netns_bind_to_path (NMPNetns *self, const char *filename, int *out_fd)
if ((fd = creat (filename, S_IRUSR | S_IRGRP | S_IROTH)) == -1) {
errsv = errno;
_LOGE (self, "bind: failed to create %s: %s",
filename, g_strerror (errsv));
filename, nm_strerror_native (errsv));
return FALSE;
}
nm_close (fd);
......@@ -669,7 +669,7 @@ nmp_netns_bind_to_path (NMPNetns *self, const char *filename, int *out_fd)
if (mount (PROC_SELF_NS_NET, filename, "none", MS_BIND, NULL) != 0) {
errsv = errno;
_LOGE (self, "bind: failed to mount %s to %s: %s",
PROC_SELF_NS_NET, filename, g_strerror (errsv));
PROC_SELF_NS_NET, filename, nm_strerror_native (errsv));
unlink (filename);
return FALSE;
}
......@@ -677,7 +677,7 @@ nmp_netns_bind_to_path (NMPNetns *self, const char *filename, int *out_fd)
if (out_fd) {
if ((fd = open (filename, O_RDONLY | O_CLOEXEC)) == -1) {
errsv = errno;
_LOGE (self, "bind: failed to open %s: %s", filename, g_strerror (errsv));
_LOGE (self, "bind: failed to open %s: %s", filename, nm_strerror_native (errsv));
umount2 (filename, MNT_DETACH);
unlink (filename);
return FALSE;
......@@ -698,12 +698,12 @@ nmp_netns_bind_to_path_destroy (NMPNetns *self, const char *filename)
if (umount2 (filename, MNT_DETACH) != 0) {
errsv = errno;
_LOGE (self, "bind: failed to unmount2 %s: %s", filename, g_strerror (errsv));
_LOGE (self, "bind: failed to unmount2 %s: %s", filename, nm_strerror_native (errsv));
return FALSE;
}
if (unlink (filename) != 0) {
errsv = errno;
_LOGE (self, "bind: failed to unlink %s: %s", filename, g_strerror (errsv));
_LOGE (self, "bind: failed to unlink %s: %s", filename, nm_strerror_native (errsv));
return FALSE;
}
return TRUE;
......
......@@ -2393,7 +2393,7 @@ _test_netns_check_skip (void)
support_errsv = errno;
}
if (!support) {
_LOGD ("setns() failed with \"%s\". This indicates missing support (valgrind?)", g_strerror (support_errsv));
_LOGD ("setns() failed with \"%s\". This indicates missing support (valgrind?)", nm_strerror_native (support_errsv));
g_test_skip ("No netns support (setns failed)");
return TRUE;
}
......
......@@ -115,7 +115,7 @@ get_ifname (int ifindex, char *buffer, const char *op)
errsv = errno;
_LOGW (LOGD_PLATFORM | LOGD_WIFI,
"error getting interface name for ifindex %d, operation '%s': %s (%d)",
ifindex, op, g_strerror (errsv), errsv);
ifindex, op, nm_strerror_native (errsv), errsv);
return FALSE;
}
......
......@@ -4994,7 +4994,7 @@ handle_bridge_option (NMSetting *setting,
} else {
v = _nm_utils_ascii_str_to_int64 (value, 10, 0, 1, -1);
if (v == -1) {
error_message = g_strerror (errno);
error_message = nm_strerror_native (errno);
goto warn;
}
}
......@@ -5006,7 +5006,7 @@ handle_bridge_option (NMSetting *setting,
case G_TYPE_UINT:
v = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT, -1);
if (v == -1) {
error_message = g_strerror (errno);
error_message = nm_strerror_native (errno);
goto warn;
}
if (!nm_g_object_set_property_uint (G_OBJECT (setting), m[i].property_name, v, NULL)) {
......
......@@ -10025,7 +10025,7 @@ int main (int argc, char **argv)
if (g_mkdir_with_parents (TEST_SCRATCH_DIR_TMP, 0755) != 0) {
errsv = errno;
g_error ("failure to create test directory \"%s\": %s", TEST_SCRATCH_DIR_TMP, g_strerror (errsv));
g_error ("failure to create test directory \"%s\": %s", TEST_SCRATCH_DIR_TMP, nm_strerror_native (errsv));
}
g_test_add_func (TPATH "svUnescape", test_svUnescape);
......
......@@ -276,14 +276,14 @@ nms_keyfile_utils_check_file_permissions (NMSKeyfileFiletype filetype,
if (stat (filename, &st) != 0) {
errsv = errno;
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"cannot access file: %s", g_strerror (errsv));
"cannot access file: %s", nm_strerror_native (errsv));
return FALSE;
}
} else if (filetype == NMS_KEYFILE_FILETYPE_NMLOADED) {
if (lstat (filename, &st) != 0) {
errsv = errno;
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"cannot access file: %s", g_strerror (errsv));
"cannot access file: %s", nm_strerror_native (errsv));
return FALSE;
}
} else
......
......@@ -298,7 +298,7 @@ _internal_write_connection (NMConnection *connection,
errsv = errno;
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED,
"error chowning '%s': %s (%d)",
path, g_strerror (errsv), errsv);
path, nm_strerror_native (errsv), errsv);
unlink (path);
return FALSE;
}
......
......@@ -2622,7 +2622,7 @@ int main (int argc, char **argv)
if (g_mkdir_with_parents (TEST_SCRATCH_DIR, 0755) != 0) {
errsv = errno;
g_error ("failure to create test directory \"%s\": %s", TEST_SCRATCH_DIR, g_strerror (errsv));
g_error ("failure to create test directory \"%s\": %s", TEST_SCRATCH_DIR, nm_strerror_native (errsv));
}
/* The tests */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment