Commit 9beed4f6 authored by Thomas Haller's avatar Thomas Haller

all: replace strerror() calls with nm_strerror_native()

parent a4fb6ddf
......@@ -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]);
......
......@@ -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;
}
......
......@@ -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));
}
}
......
......@@ -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;
......
......@@ -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);
}
}
......
......@@ -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) {
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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");
}
......
......@@ -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;
}
......
......@@ -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 {
......
......@@ -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);
......
......@@ -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!");
}
......
......@@ -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)
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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);
}
}
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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)) {
......
......@@ -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;
}
......
......@@ -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");
......
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