summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-01-31 17:22:18 +0100
committerThomas Haller <thaller@redhat.com>2019-02-12 08:50:28 +0100
commit9beed4f661d0b8e02c16a616e7491baa42af0843 (patch)
tree73d89a906ec4399751dec36cee92bc0a918c0a93
parenta4fb6ddfca60c50cdf140d3f388209ace06e24ff (diff)
downloadNetworkManager-9beed4f661d0b8e02c16a616e7491baa42af0843.tar.gz
all: replace strerror() calls with nm_strerror_native()
-rw-r--r--clients/cli/utils.c12
-rw-r--r--libnm-core/nm-utils.c2
-rw-r--r--shared/nm-utils/nm-test-utils.h6
-rw-r--r--src/devices/bluetooth/nm-bluez5-dun.c14
-rw-r--r--src/devices/nm-device.c4
-rw-r--r--src/dns/nm-dns-manager.c2
-rw-r--r--src/initrd/nm-initrd-generator.c2
-rw-r--r--src/main-utils.c6
-rw-r--r--src/nm-audit-manager.c2
-rw-r--r--src/nm-core-utils.c28
-rw-r--r--src/nm-dispatcher.c2
-rw-r--r--src/nm-iface-helper.c2
-rw-r--r--src/nm-policy.c2
-rw-r--r--src/nm-session-monitor.c2
-rw-r--r--src/platform/nm-linux-platform.c20
-rw-r--r--src/platform/nm-platform-utils.c6
-rw-r--r--src/platform/tests/test-common.c12
-rw-r--r--src/platform/wifi/nm-wifi-utils-wext.c10
-rw-r--r--src/ppp/nm-ppp-manager.c4
-rw-r--r--src/settings/nm-settings.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/nm-inotify-helper.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/shvar.c8
22 files changed, 75 insertions, 75 deletions
diff --git a/clients/cli/utils.c b/clients/cli/utils.c
index b3190b085c..0e74ba8867 100644
--- a/clients/cli/utils.c
+++ b/clients/cli/utils.c
@@ -1434,12 +1434,12 @@ pager_fallback (void)
errsv = errno;
if (errsv == EINTR)
continue;
- g_printerr (_("Error reading nmcli output: %s\n"), strerror (errsv));
+ g_printerr (_("Error reading nmcli output: %s\n"), nm_strerror_native (errsv));
_exit(EXIT_FAILURE);
}
if (write (STDOUT_FILENO, buf, rb) == -1) {
errsv = errno;
- g_printerr (_("Error writing nmcli output: %s\n"), strerror (errsv));
+ g_printerr (_("Error writing nmcli output: %s\n"), nm_strerror_native (errsv));
_exit(EXIT_FAILURE);
}
} while (rb > 0);
@@ -1465,7 +1465,7 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config)
if (pipe (fd) == -1) {
errsv = errno;
- g_printerr (_("Failed to create pager pipe: %s\n"), strerror (errsv));
+ g_printerr (_("Failed to create pager pipe: %s\n"), nm_strerror_native (errsv));
return 0;
}
@@ -1474,7 +1474,7 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config)
pager_pid = fork ();
if (pager_pid == -1) {
errsv = errno;
- g_printerr (_("Failed to fork pager: %s\n"), strerror (errsv));
+ g_printerr (_("Failed to fork pager: %s\n"), nm_strerror_native (errsv));
nm_close (fd[0]);
nm_close (fd[1]);
return 0;
@@ -1521,11 +1521,11 @@ nmc_terminal_spawn_pager (const NmcConfig *nmc_config)
/* Return in the parent */
if (dup2 (fd[1], STDOUT_FILENO) < 0) {
errsv = errno;
- g_printerr (_("Failed to duplicate pager pipe: %s\n"), strerror (errsv));
+ g_printerr (_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native (errsv));
}
if (dup2 (fd[1], STDERR_FILENO) < 0) {
errsv = errno;
- g_printerr (_("Failed to duplicate pager pipe: %s\n"), strerror (errsv));
+ g_printerr (_("Failed to duplicate pager pipe: %s\n"), nm_strerror_native (errsv));
}
nm_close (fd[0]);
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index b1d5761ff3..506f434497 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -3105,7 +3105,7 @@ _nm_utils_check_file (const char *filename,
g_set_error (error,
NM_VPN_PLUGIN_ERROR,
NM_VPN_PLUGIN_ERROR_FAILED,
- _("failed stat file %s: %s"), filename, strerror (errsv));
+ _("failed stat file %s: %s"), filename, nm_strerror_native (errsv));
return FALSE;
}
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h
index 5424d22247..c5ea5e3f2d 100644
--- a/shared/nm-utils/nm-test-utils.h
+++ b/shared/nm-utils/nm-test-utils.h
@@ -1060,7 +1060,7 @@ nmtst_reexec_sudo (void)
execvp (__nmtst_internal.sudo_cmd, argv);
errsv = errno;
- g_error (">> exec %s failed: %d - %s", __nmtst_internal.sudo_cmd, errsv, strerror (errsv));
+ g_error (">> exec %s failed: %d - %s", __nmtst_internal.sudo_cmd, errsv, nm_strerror_native (errsv));
}
/*****************************************************************************/
@@ -1370,7 +1370,7 @@ nmtst_file_unlink_if_exists (const char *name)
if (unlink (name) != 0) {
errsv = errno;
if (errsv != ENOENT)
- g_error ("nmtst_file_unlink_if_exists(%s): failed with %s", name, strerror (errsv));
+ g_error ("nmtst_file_unlink_if_exists(%s): failed with %s", name, nm_strerror_native (errsv));
}
}
@@ -1383,7 +1383,7 @@ nmtst_file_unlink (const char *name)
if (unlink (name) != 0) {
errsv = errno;
- g_error ("nmtst_file_unlink(%s): failed with %s", name, strerror (errsv));
+ g_error ("nmtst_file_unlink(%s): failed with %s", name, nm_strerror_native (errsv));
}
}
diff --git a/src/devices/bluetooth/nm-bluez5-dun.c b/src/devices/bluetooth/nm-bluez5-dun.c
index ae5efcedfc..ff3a0da99e 100644
--- a/src/devices/bluetooth/nm-bluez5-dun.c
+++ b/src/devices/bluetooth/nm-bluez5-dun.c
@@ -69,7 +69,7 @@ dun_connect (NMBluez5DunContext *context)
errsv = errno;
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Failed to create RFCOMM socket: (%d) %s",
- errsv, strerror (errsv));
+ errsv, nm_strerror_native (errsv));
goto done;
}
@@ -81,7 +81,7 @@ dun_connect (NMBluez5DunContext *context)
errsv = errno;
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Failed to bind socket: (%d) %s",
- errsv, strerror (errsv));
+ errsv, nm_strerror_native (errsv));
goto done;
}
@@ -91,7 +91,7 @@ dun_connect (NMBluez5DunContext *context)
errsv = errno;
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Failed to connect to remote device: (%d) %s",
- errsv, strerror (errsv));
+ errsv, nm_strerror_native (errsv));
goto done;
}
@@ -106,7 +106,7 @@ dun_connect (NMBluez5DunContext *context)
errsv = errno;
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Failed to create rfcomm device: (%d) %s",
- errsv, strerror (errsv));
+ errsv, nm_strerror_native (errsv));
goto done;
}
context->rfcomm_id = devid;
@@ -271,7 +271,7 @@ sdp_connect_watch (GIOChannel *channel, GIOCondition condition, gpointer user_da
if (err != 0) {
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Error on Service Discovery socket: (%d) %s",
- err, strerror (err));
+ err, nm_strerror_native (err));
goto done;
}
@@ -298,7 +298,7 @@ sdp_connect_watch (GIOChannel *channel, GIOCondition condition, gpointer user_da
error = g_error_new (NM_BT_ERROR,
NM_BT_ERROR_DUN_CONNECT_FAILED,
"Error starting Service Discovery: (%d) %s",
- err, strerror (err));
+ err, nm_strerror_native (err));
}
sdp_list_free (attrs, NULL);
@@ -359,7 +359,7 @@ nm_bluez5_dun_connect (NMBluez5DunContext *context,
error = g_error_new (NM_BT_ERROR, NM_BT_ERROR_DUN_CONNECT_FAILED,
"Failed to connect to the SDP server: (%d) %s",
- err, strerror (err));
+ err, nm_strerror_native (err));
/* FIXME: don't invoke the callback synchronously. */
context->callback (context, NULL, error, context->user_data);
return;
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 2426bb4d8a..8b68469cd9 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -10183,7 +10183,7 @@ 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_dynaddr"), "1")) {
errsv = errno;
_LOGD (LOGD_SHARING, "share: error enabling dynamic addresses: (%d) %s",
- errsv, strerror (errsv));
+ errsv, nm_strerror_native (errsv));
}
for (iter = modules; *iter; iter++)
@@ -10569,7 +10569,7 @@ activate_stage5_ip6_config_commit (NMDevice *self)
if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) {
if (!nm_platform_sysctl_set (nm_device_get_platform (self), NMP_SYSCTL_PATHID_ABSOLUTE ("/proc/sys/net/ipv6/conf/all/forwarding"), "1")) {
errsv = errno;
- _LOGE (LOGD_SHARING, "share: error enabling IPv6 forwarding: (%d) %s", errsv, strerror (errsv));
+ _LOGE (LOGD_SHARING, "share: error enabling IPv6 forwarding: (%d) %s", errsv, nm_strerror_native (errsv));
nm_device_ip_method_failed (self, AF_INET6, NM_DEVICE_STATE_REASON_SHARED_START_FAILED);
}
}
diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c
index e506a890a9..c7c561c459 100644
--- a/src/dns/nm-dns-manager.c
+++ b/src/dns/nm-dns-manager.c
@@ -569,7 +569,7 @@ again:
errsv = errno;
g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED,
"Error waiting for netconfig to exit: %s",
- strerror (errsv));
+ nm_strerror_native (errsv));
return SR_ERROR;
}
if (!WIFEXITED (status) || WEXITSTATUS (status) != EXIT_SUCCESS) {
diff --git a/src/initrd/nm-initrd-generator.c b/src/initrd/nm-initrd-generator.c
index 9946be7df8..b84543c42e 100644
--- a/src/initrd/nm-initrd-generator.c
+++ b/src/initrd/nm-initrd-generator.c
@@ -123,7 +123,7 @@ main (int argc, char *argv[])
if (connections_dir && g_mkdir_with_parents (connections_dir, 0755) != 0) {
errsv = errno;
- _LOGW (LOGD_CORE, "%s: %s", connections_dir, strerror (errsv));
+ _LOGW (LOGD_CORE, "%s: %s", connections_dir, nm_strerror_native (errsv));
return 1;
}
diff --git a/src/main-utils.c b/src/main-utils.c
index 199945014c..f3a2edf5e1 100644
--- a/src/main-utils.c
+++ b/src/main-utils.c
@@ -97,20 +97,20 @@ nm_main_utils_write_pidfile (const char *pidfile)
if ((fd = open (pidfile, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 00644)) < 0) {
errsv = errno;
- fprintf (stderr, _("Opening %s failed: %s\n"), pidfile, strerror (errsv));
+ fprintf (stderr, _("Opening %s failed: %s\n"), pidfile, nm_strerror_native (errsv));
return FALSE;
}
g_snprintf (pid, sizeof (pid), "%d", getpid ());
if (write (fd, pid, strlen (pid)) < 0) {
errsv = errno;
- fprintf (stderr, _("Writing to %s failed: %s\n"), pidfile, strerror (errsv));
+ fprintf (stderr, _("Writing to %s failed: %s\n"), pidfile, nm_strerror_native (errsv));
} else
success = TRUE;
if (nm_close (fd)) {
errsv = errno;
- fprintf (stderr, _("Closing %s failed: %s\n"), pidfile, strerror (errsv));
+ fprintf (stderr, _("Closing %s failed: %s\n"), pidfile, nm_strerror_native (errsv));
}
return success;
diff --git a/src/nm-audit-manager.c b/src/nm-audit-manager.c
index 05fc88cc25..9f868508be 100644
--- a/src/nm-audit-manager.c
+++ b/src/nm-audit-manager.c
@@ -344,7 +344,7 @@ init_auditd (NMAuditManager *self)
priv->auditd_fd = audit_open ();
if (priv->auditd_fd < 0) {
errsv = errno;
- _LOGE (LOGD_CORE, "failed to open auditd socket: %s", strerror (errsv));
+ _LOGE (LOGD_CORE, "failed to open auditd socket: %s", nm_strerror_native (errsv));
} else
_LOGD (LOGD_CORE, "socket created");
}
diff --git a/src/nm-core-utils.c b/src/nm-core-utils.c
index 2798b07f21..6141c5f1cf 100644
--- a/src/nm-core-utils.c
+++ b/src/nm-core-utils.c
@@ -573,7 +573,7 @@ _kc_cb_timeout_grace_period (void *user_data)
/* ESRCH means, process does not exist or is already a zombie. */
if (errsv != ESRCH) {
nm_log_err (LOGD_CORE | data->log_domain, "%s: kill(SIGKILL) returned unexpected return value %d: (%s, %d)",
- data->log_name, ret, strerror (errsv), errsv);
+ data->log_name, ret, nm_strerror_native (errsv), errsv);
}
} else {
nm_log_dbg (data->log_domain, "%s: process not terminated after %ld usec. Sending SIGKILL signal",
@@ -659,7 +659,7 @@ nm_utils_kill_child_async (pid_t pid, int sig, NMLogDomain log_domain,
/* ECHILD means, the process is not a child/does not exist or it has SIGCHILD blocked. */
if (errsv != ECHILD) {
nm_log_err (LOGD_CORE | log_domain, LOG_NAME_FMT ": unexpected error while waitpid: %s (%d)",
- LOG_NAME_ARGS, strerror (errsv), errsv);
+ LOG_NAME_ARGS, nm_strerror_native (errsv), errsv);
_kc_invoke_callback (pid, log_domain, log_name, callback, user_data, FALSE, -1);
return;
}
@@ -671,7 +671,7 @@ nm_utils_kill_child_async (pid_t pid, int sig, NMLogDomain log_domain,
/* ESRCH means, process does not exist or is already a zombie. */
if (errsv != ESRCH) {
nm_log_err (LOGD_CORE | log_domain, LOG_NAME_FMT ": unexpected error sending %s: %s (%d)",
- LOG_NAME_ARGS, _kc_signal_to_string (sig), strerror (errsv), errsv);
+ LOG_NAME_ARGS, _kc_signal_to_string (sig), nm_strerror_native (errsv), errsv);
_kc_invoke_callback (pid, log_domain, log_name, callback, user_data, FALSE, -1);
return;
}
@@ -685,7 +685,7 @@ nm_utils_kill_child_async (pid_t pid, int sig, NMLogDomain log_domain,
} else {
errsv = errno;
nm_log_err (LOGD_CORE | log_domain, LOG_NAME_FMT ": failed due to unexpected return value %ld by waitpid (%s, %d) after sending %s",
- LOG_NAME_ARGS, (long) ret, strerror (errsv), errsv, _kc_signal_to_string (sig));
+ LOG_NAME_ARGS, (long) ret, nm_strerror_native (errsv), errsv, _kc_signal_to_string (sig));
_kc_invoke_callback (pid, log_domain, log_name, callback, user_data, FALSE, -1);
}
return;
@@ -767,7 +767,7 @@ nm_utils_kill_child_sync (pid_t pid, int sig, NMLogDomain log_domain, const char
/* ECHILD means, the process is not a child/does not exist or it has SIGCHILD blocked. */
if (errsv != ECHILD) {
nm_log_err (LOGD_CORE | log_domain, LOG_NAME_FMT ": unexpected error while waitpid: %s (%d)",
- LOG_NAME_ARGS, strerror (errsv), errsv);
+ LOG_NAME_ARGS, nm_strerror_native (errsv), errsv);
goto out;
}
}
@@ -778,7 +778,7 @@ nm_utils_kill_child_sync (pid_t pid, int sig, NMLogDomain log_domain, const char
/* ESRCH means, process does not exist or is already a zombie. */
if (errsv != ESRCH) {
nm_log_err (LOGD_CORE | log_domain, LOG_NAME_FMT ": failed to send %s: %s (%d)",
- LOG_NAME_ARGS, _kc_signal_to_string (sig), strerror (errsv), errsv);
+ LOG_NAME_ARGS, _kc_signal_to_string (sig), nm_strerror_native (errsv), errsv);
} else {
/* let's try again with waitpid, probably there was a race... */
ret = waitpid (pid, &status, 0);
@@ -789,7 +789,7 @@ nm_utils_kill_child_sync (pid_t pid, int sig, NMLogDomain log_domain, const char
} else {
errsv = errno;
nm_log_err (LOGD_CORE | log_domain, LOG_NAME_FMT ": failed due to unexpected return value %ld by waitpid (%s, %d) after sending %s",
- LOG_NAME_ARGS, (long) ret, strerror (errsv), errsv, _kc_signal_to_string (sig));
+ LOG_NAME_ARGS, (long) ret, nm_strerror_native (errsv), errsv, _kc_signal_to_string (sig));
}
}
goto out;
@@ -820,7 +820,7 @@ nm_utils_kill_child_sync (pid_t pid, int sig, NMLogDomain log_domain, const char
/* ECHILD means, the process is not a child/does not exist or it has SIGCHILD blocked. */
if (errsv != ECHILD) {
nm_log_err (LOGD_CORE | log_domain, LOG_NAME_FMT ": after sending %s, waitpid failed with %s (%d)%s",
- LOG_NAME_ARGS, _kc_signal_to_string (sig), strerror (errsv), errsv,
+ LOG_NAME_ARGS, _kc_signal_to_string (sig), nm_strerror_native (errsv), errsv,
was_waiting ? _kc_waited_to_string (buf_wait, wait_start_us) : "");
goto out;
}
@@ -859,7 +859,7 @@ nm_utils_kill_child_sync (pid_t pid, int sig, NMLogDomain log_domain, const char
/* ESRCH means, process does not exist or is already a zombie. */
if (errsv != ESRCH) {
nm_log_err (LOGD_CORE | log_domain, LOG_NAME_FMT ": failed to send SIGKILL (after sending %s), %s (%d)",
- LOG_NAME_ARGS, _kc_signal_to_string (sig), strerror (errsv), errsv);
+ LOG_NAME_ARGS, _kc_signal_to_string (sig), nm_strerror_native (errsv), errsv);
goto out;
}
}
@@ -877,7 +877,7 @@ nm_utils_kill_child_sync (pid_t pid, int sig, NMLogDomain log_domain, const char
if (errsv != EINTR) {
nm_log_err (LOGD_CORE | log_domain, LOG_NAME_FMT ": after sending %s%s, waitpid failed with %s (%d)%s",
- LOG_NAME_ARGS, _kc_signal_to_string (sig), send_kill ? " and SIGKILL" : "", strerror (errsv), errsv,
+ LOG_NAME_ARGS, _kc_signal_to_string (sig), send_kill ? " and SIGKILL" : "", nm_strerror_native (errsv), errsv,
_kc_waited_to_string (buf_wait, wait_start_us));
goto out;
}
@@ -965,7 +965,7 @@ nm_utils_kill_process_sync (pid_t pid, guint64 start_time, int sig, NMLogDomain
LOG_NAME_ARGS, _kc_signal_to_string (sig));
} else {
nm_log_warn (LOGD_CORE | log_domain, LOG_NAME_PROCESS_FMT ": failed to send %s: %s (%d)",
- LOG_NAME_ARGS, _kc_signal_to_string (sig), strerror (errsv), errsv);
+ LOG_NAME_ARGS, _kc_signal_to_string (sig), nm_strerror_native (errsv), errsv);
}
return;
}
@@ -1016,7 +1016,7 @@ nm_utils_kill_process_sync (pid_t pid, guint64 start_time, int sig, NMLogDomain
was_waiting ? _kc_waited_to_string (buf_wait, wait_start_us) : "");
} else {
nm_log_warn (LOGD_CORE | log_domain, LOG_NAME_PROCESS_FMT ": failed to kill(%ld, 0): %s (%d)%s",
- LOG_NAME_ARGS, (long int) pid, strerror (errsv), errsv,
+ LOG_NAME_ARGS, (long int) pid, nm_strerror_native (errsv), errsv,
was_waiting ? _kc_waited_to_string (buf_wait, wait_start_us) : "");
}
return;
@@ -1052,7 +1052,7 @@ nm_utils_kill_process_sync (pid_t pid, guint64 start_time, int sig, NMLogDomain
LOG_NAME_ARGS, _kc_waited_to_string (buf_wait, wait_start_us));
} else {
nm_log_warn (LOGD_CORE | log_domain, LOG_NAME_PROCESS_FMT ": failed to send SIGKILL (after sending %s), %s (%d)%s",
- LOG_NAME_ARGS, _kc_signal_to_string (sig), strerror (errsv), errsv,
+ LOG_NAME_ARGS, _kc_signal_to_string (sig), nm_strerror_native (errsv), errsv,
_kc_waited_to_string (buf_wait, wait_start_us));
}
return;
@@ -4141,7 +4141,7 @@ nm_utils_read_plugin_paths (const char *dirname, const char *prefix)
errsv = errno;
nm_log_warn (LOGD_CORE,
"plugin: skip invalid file %s (error during stat: %s)",
- data.path, strerror (errsv));
+ data.path, nm_strerror_native (errsv));
goto skip;
}
diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c
index 4d8d9f8a8e..c0ef1bb6b0 100644
--- a/src/nm-dispatcher.c
+++ b/src/nm-dispatcher.c
@@ -962,7 +962,7 @@ dispatcher_dir_changed (GFileMonitor *monitor,
else if (errsv == 0)
_LOGD ("%s script directory '%s' has no scripts", item->description, item->dir);
else {
- _LOGD ("%s script directory '%s' error reading (%s)", item->description, item->dir, strerror (errsv));
+ _LOGD ("%s script directory '%s' error reading (%s)", item->description, item->dir, nm_strerror_native (errsv));
item->has_scripts = TRUE;
}
} else {
diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c
index 4d931ddd01..1ef9f5aea6 100644
--- a/src/nm-iface-helper.c
+++ b/src/nm-iface-helper.c
@@ -425,7 +425,7 @@ main (int argc, char *argv[])
gl.ifindex = nmp_utils_if_nametoindex (global_opt.ifname);
if (gl.ifindex <= 0) {
errsv = errno;
- fprintf (stderr, _("Failed to find interface index for %s (%s)\n"), global_opt.ifname, strerror (errsv));
+ fprintf (stderr, _("Failed to find interface index for %s (%s)\n"), global_opt.ifname, nm_strerror_native (errsv));
return 1;
}
pidfile = g_strdup_printf (NMIH_PID_FILE_FMT, gl.ifindex);
diff --git a/src/nm-policy.c b/src/nm-policy.c
index a22b63326d..cb0688f43b 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -514,7 +514,7 @@ settings_set_hostname_cb (const char *hostname,
if (ret != 0) {
errsv = errno;
_LOGW (LOGD_DNS, "set-hostname: couldn't set the system hostname to '%s': (%d) %s",
- hostname, errsv, strerror (errsv));
+ hostname, errsv, nm_strerror_native (errsv));
if (errsv == EPERM)
_LOGW (LOGD_DNS, "set-hostname: you should use hostnamed when systemd hardening is in effect!");
}
diff --git a/src/nm-session-monitor.c b/src/nm-session-monitor.c
index 31810b8dc7..e8c25fd648 100644
--- a/src/nm-session-monitor.c
+++ b/src/nm-session-monitor.c
@@ -212,7 +212,7 @@ ck_update_cache (NMSessionMonitor *monitor)
/* Check the database file */
if (stat (CKDB_PATH, &statbuf) != 0) {
errsv = errno;
- _LOGE ("failed to check ConsoleKit timestamp: %s", strerror (errsv));
+ _LOGE ("failed to check ConsoleKit timestamp: %s", nm_strerror_native (errsv));
return FALSE;
}
if (statbuf.st_mtime == monitor->ck.timestamp)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 78ccac8b69..ce96c18426 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -4050,10 +4050,10 @@ sysctl_set (NMPlatform *platform, const char *pathid, int dirfd, const char *pat
errsv = errno;
if (errsv == ENOENT) {
_LOGD ("sysctl: failed to open '%s': (%d) %s",
- pathid, errsv, strerror (errsv));
+ pathid, errsv, nm_strerror_native (errsv));
} else {
_LOGE ("sysctl: failed to open '%s': (%d) %s",
- pathid, errsv, strerror (errsv));
+ pathid, errsv, nm_strerror_native (errsv));
}
errno = errsv;
return FALSE;
@@ -4064,10 +4064,10 @@ sysctl_set (NMPlatform *platform, const char *pathid, int dirfd, const char *pat
errsv = errno;
if (errsv == ENOENT) {
_LOGD ("sysctl: failed to openat '%s': (%d) %s",
- pathid, errsv, strerror (errsv));
+ pathid, errsv, nm_strerror_native (errsv));
} else {
_LOGE ("sysctl: failed to openat '%s': (%d) %s",
- pathid, errsv, strerror (errsv));
+ pathid, errsv, nm_strerror_native (errsv));
}
errno = errsv;
return FALSE;
@@ -4117,7 +4117,7 @@ sysctl_set (NMPlatform *platform, const char *pathid, int dirfd, const char *pat
}
_NMLOG (level, "sysctl: failed to set '%s' to '%s': (%d) %s",
- path, value, errsv, strerror (errsv));
+ path, value, errsv, nm_strerror_native (errsv));
} else if (nwrote < len - 1) {
_LOGE ("sysctl: failed to set '%s' to '%s' after three attempts",
path, value);
@@ -6144,7 +6144,7 @@ link_set_sriov_params (NMPlatform *platform,
"device/sriov_numvfs"),
"0")) {
errsv = errno;
- _LOGW ("link: couldn't reset SR-IOV num_vfs: %s", strerror (errsv));
+ _LOGW ("link: couldn't reset SR-IOV num_vfs: %s", nm_strerror_native (errsv));
return FALSE;
}
}
@@ -6160,7 +6160,7 @@ link_set_sriov_params (NMPlatform *platform,
"device/sriov_drivers_autoprobe"),
nm_sprintf_buf (buf, "%d", (int) autoprobe))) {
errsv = errno;
- _LOGW ("link: couldn't set SR-IOV drivers-autoprobe to %d: %s", (int) autoprobe, strerror (errsv));
+ _LOGW ("link: couldn't set SR-IOV drivers-autoprobe to %d: %s", (int) autoprobe, nm_strerror_native (errsv));
return FALSE;
}
@@ -6170,7 +6170,7 @@ link_set_sriov_params (NMPlatform *platform,
"device/sriov_numvfs"),
nm_sprintf_buf (buf, "%u", num_vfs))) {
errsv = errno;
- _LOGW ("link: couldn't set SR-IOV num_vfs to %d: %s", num_vfs, strerror (errsv));
+ _LOGW ("link: couldn't set SR-IOV num_vfs to %d: %s", num_vfs, nm_strerror_native (errsv));
return FALSE;
}
@@ -7845,7 +7845,7 @@ continue_reading:
/* Error message reported back from kernel. */
_LOGD ("netlink: recvmsg: error message from kernel: %s (%d)%s%s%s for request %d",
- strerror (errsv),
+ nm_strerror_native (errsv),
errsv,
NM_PRINT_FMT_QUOTED (extack_msg, " \"", extack_msg, "\"", ""),
nlmsg_hdr (msg)->nlmsg_seq);
@@ -8008,7 +8008,7 @@ after_read:
int errsv = errno;
if (errsv != EINTR) {
- _LOGE ("netlink: read: poll failed with %s", strerror (errsv));
+ _LOGE ("netlink: read: poll failed with %s", nm_strerror_native (errsv));
delayed_action_wait_for_nl_response_complete_all (platform, WAIT_FOR_NL_RESPONSE_RESULT_FAILED_POLL);
return any;
}
diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c
index 0116e887bd..93cd0b3c8b 100644
--- a/src/platform/nm-platform-utils.c
+++ b/src/platform/nm-platform-utils.c
@@ -157,7 +157,7 @@ ethtool_call_handle (SocketHandle *shandle, gpointer edata)
shandle->ifindex,
_ethtool_data_to_string (edata, sbuf, sizeof (sbuf)),
shandle->ifname,
- strerror (errsv));
+ nm_strerror_native (errsv));
return -NM_ERRNO_NATIVE (errsv);
}
@@ -1059,7 +1059,7 @@ nmp_utils_mii_supports_carrier_detect (int ifindex)
if (ioctl (shandle.fd, SIOCGMIIPHY, &ifr) < 0) {
errsv = errno;
- nm_log_trace (LOGD_PLATFORM, "mii[%d,%s]: carrier-detect no: SIOCGMIIPHY failed: %s", ifindex, shandle.ifname, strerror (errsv));
+ nm_log_trace (LOGD_PLATFORM, "mii[%d,%s]: carrier-detect no: SIOCGMIIPHY failed: %s", ifindex, shandle.ifname, nm_strerror_native (errsv));
return FALSE;
}
@@ -1069,7 +1069,7 @@ nmp_utils_mii_supports_carrier_detect (int ifindex)
if (ioctl (shandle.fd, SIOCGMIIREG, &ifr) != 0) {
errsv = errno;
- nm_log_trace (LOGD_PLATFORM, "mii[%d,%s]: carrier-detect no: SIOCGMIIREG failed: %s", ifindex, shandle.ifname, strerror (errsv));
+ nm_log_trace (LOGD_PLATFORM, "mii[%d,%s]: carrier-detect no: SIOCGMIIREG failed: %s", ifindex, shandle.ifname, nm_strerror_native (errsv));
return FALSE;
}
diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c
index 8e29b5ce8d..c510710b17 100644
--- a/src/platform/tests/test-common.c
+++ b/src/platform/tests/test-common.c
@@ -1840,7 +1840,7 @@ nmtstp_namespace_create (int unshare_flags, GError **error)
if (e != 0) {
errsv = errno;
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
- "pipe() failed with %d (%s)", errsv, strerror (errsv));
+ "pipe() failed with %d (%s)", errsv, nm_strerror_native (errsv));
return FALSE;
}
@@ -1848,7 +1848,7 @@ nmtstp_namespace_create (int unshare_flags, GError **error)
if (e != 0) {
errsv = errno;
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
- "pipe() failed with %d (%s)", errsv, strerror (errsv));
+ "pipe() failed with %d (%s)", errsv, nm_strerror_native (errsv));
nm_close (pipefd_c2p[0]);
nm_close (pipefd_c2p[1]);
return FALSE;
@@ -1858,7 +1858,7 @@ nmtstp_namespace_create (int unshare_flags, GError **error)
if (pid < 0) {
errsv = errno;
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
- "fork() failed with %d (%s)", errsv, strerror (errsv));
+ "fork() failed with %d (%s)", errsv, nm_strerror_native (errsv));
nm_close (pipefd_c2p[0]);
nm_close (pipefd_c2p[1]);
nm_close (pipefd_p2c[0]);
@@ -1919,7 +1919,7 @@ nmtstp_namespace_create (int unshare_flags, GError **error)
"child process failed for unknown reason");
} else {
g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
- "child process signaled failure %d (%s)", errsv, strerror (errsv));
+ "child process signaled failure %d (%s)", errsv, nm_strerror_native (errsv));
}
nm_close (pipefd_p2c[1]);
kill (pid, SIGKILL);
@@ -2074,14 +2074,14 @@ main (int argc, char **argv)
if (unshare (CLONE_NEWNET | CLONE_NEWNS) != 0) {
errsv = errno;
- g_error ("unshare(CLONE_NEWNET|CLONE_NEWNS) failed with %s (%d)", strerror (errsv), errsv);
+ g_error ("unshare(CLONE_NEWNET|CLONE_NEWNS) failed with %s (%d)", nm_strerror_native (errsv), errsv);
}
/* We need a read-only /sys so that the platform knows there's no udev. */
mount (NULL, "/sys", "sysfs", MS_SLAVE, NULL);
if (mount ("sys", "/sys", "sysfs", MS_RDONLY, NULL) != 0) {
errsv = errno;
- g_error ("mount(\"/sys\") failed with %s (%d)", strerror (errsv), errsv);
+ g_error ("mount(\"/sys\") failed with %s (%d)", nm_strerror_native (errsv), errsv);
}
}
diff --git a/src/platform/wifi/nm-wifi-utils-wext.c b/src/platform/wifi/nm-wifi-utils-wext.c
index 888575778b..3aa1720ae6 100644
--- a/src/platform/wifi/nm-wifi-utils-wext.c
+++ b/src/platform/wifi/nm-wifi-utils-wext.c
@@ -253,7 +253,7 @@ wifi_wext_get_freq (NMWifiUtils *data)
if (ioctl (wext->fd, SIOCGIWFREQ, &wrq) < 0) {
_LOGW (LOGD_PLATFORM | LOGD_WIFI,
"(%s): error getting frequency: %s",
- ifname, strerror (errno));
+ ifname, nm_strerror_native (errno));
return 0;
}
@@ -291,7 +291,7 @@ wifi_wext_get_bssid (NMWifiUtils *data, guint8 *out_bssid)
if (ioctl (wext->fd, SIOCGIWAP, &wrq) < 0) {
_LOGW (LOGD_PLATFORM | LOGD_WIFI,
"(%s): error getting associated BSSID: %s",
- ifname, strerror (errno));
+ ifname, nm_strerror_native (errno));
return FALSE;
}
memcpy (out_bssid, &(wrq.u.ap_addr.sa_data), ETH_ALEN);
@@ -429,7 +429,7 @@ wifi_wext_get_qual (NMWifiUtils *data)
if (ioctl (wext->fd, SIOCGIWSTATS, &wrq) < 0) {
_LOGW (LOGD_PLATFORM | LOGD_WIFI,
"(%s): error getting signal strength: %s",
- ifname, strerror (errno));
+ ifname, nm_strerror_native (errno));
return -1;
}
@@ -476,7 +476,7 @@ wifi_wext_set_mesh_channel (NMWifiUtils *data, guint32 channel)
if (ioctl (wext->fd, SIOCSIWFREQ, &wrq) < 0) {
_LOGE (LOGD_PLATFORM | LOGD_WIFI | LOGD_OLPC,
"(%s): error setting channel to %d: %s",
- ifname, channel, strerror (errno));
+ ifname, channel, nm_strerror_native (errno));
return FALSE;
}
@@ -514,7 +514,7 @@ wifi_wext_set_mesh_ssid (NMWifiUtils *data, const guint8 *ssid, gsize len)
"(%s): error setting SSID to %s: %s",
ifname,
(ssid_str = _nm_utils_ssid_to_string_arr (ssid, len)),
- strerror (errsv));
+ nm_strerror_native (errsv));
}
return FALSE;
diff --git a/src/ppp/nm-ppp-manager.c b/src/ppp/nm-ppp-manager.c
index 86551fc035..04c14dfbd5 100644
--- a/src/ppp/nm-ppp-manager.c
+++ b/src/ppp/nm-ppp-manager.c
@@ -194,7 +194,7 @@ monitor_cb (gpointer user_data)
if (ioctl (priv->monitor_fd, SIOCGPPPSTATS, &req) < 0) {
errsv = errno;
if (errsv != ENODEV)
- _LOGW ("could not read ppp stats: %s", strerror (errsv));
+ _LOGW ("could not read ppp stats: %s", nm_strerror_native (errsv));
} else {
g_signal_emit (self, signals[STATS], 0,
(guint) stats.p.ppp_ibytes,
@@ -218,7 +218,7 @@ monitor_stats (NMPPPManager *self)
priv->monitor_fd = socket (AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (priv->monitor_fd < 0) {
errsv = errno;
- _LOGW ("could not monitor PPP stats: %s", strerror (errsv));
+ _LOGW ("could not monitor PPP stats: %s", nm_strerror_native (errsv));
return;
}
diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c
index da910368cb..86401ce1bf 100644
--- a/src/settings/nm-settings.c
+++ b/src/settings/nm-settings.c
@@ -636,7 +636,7 @@ add_plugin_load_file (NMSettings *self, const char *pname, GError **error)
if (stat (path, &st) != 0) {
errsv = errno;
- _LOGW ("could not load plugin '%s' from file '%s': %s", pname, path, strerror (errsv));
+ _LOGW ("could not load plugin '%s' from file '%s': %s", pname, path, nm_strerror_native (errsv));
return TRUE;
}
if (!S_ISREG (st.st_mode)) {
diff --git a/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c b/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c
index 5a16c01d51..04cbb5bc8c 100644
--- a/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c
+++ b/src/settings/plugins/ifcfg-rh/nm-inotify-helper.c
@@ -146,7 +146,7 @@ init_inotify (NMInotifyHelper *self)
priv->ifd = inotify_init1 (IN_CLOEXEC);
if (priv->ifd == -1) {
errsv = errno;
- nm_log_warn (LOGD_SETTINGS, "couldn't initialize inotify: %s (%d)", strerror (errsv), errsv);
+ nm_log_warn (LOGD_SETTINGS, "couldn't initialize inotify: %s (%d)", nm_strerror_native (errsv), errsv);
return FALSE;
}
diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c
index 6df75acc66..f3d58e26c7 100644
--- a/src/settings/plugins/ifcfg-rh/shvar.c
+++ b/src/settings/plugins/ifcfg-rh/shvar.c
@@ -813,7 +813,7 @@ svOpenFileInternal (const char *name, gboolean create, GError **error)
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errsv),
"Could not read file '%s': %s",
- name, strerror (errsv));
+ name, nm_strerror_native (errsv));
return NULL;
}
@@ -1324,14 +1324,14 @@ svWriteFile (shvarFile *s, int mode, GError **error)
errsv = errno;
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errsv),
"Could not open file '%s' for writing: %s",
- s->fileName, strerror (errsv));
+ s->fileName, nm_strerror_native (errsv));
return FALSE;
}
if (ftruncate (s->fd, 0) < 0) {
errsv = errno;
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errsv),
"Could not overwrite file '%s': %s",
- s->fileName, strerror (errsv));
+ s->fileName, nm_strerror_native (errsv));
return FALSE;
}
@@ -1340,7 +1340,7 @@ svWriteFile (shvarFile *s, int mode, GError **error)
errsv = errno;
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errsv),
"Internal error writing file '%s': %s",
- s->fileName, strerror (errsv));
+ s->fileName, nm_strerror_native (errsv));
return FALSE;
}
f = fdopen (tmpfd, "w");