[network-manager-libreswan/th/vpn-plugin-debug-bgo766872: 5/22] properties: cache errno in local variable
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-libreswan/th/vpn-plugin-debug-bgo766872: 5/22] properties: cache errno in local variable
- Date: Thu, 9 Jun 2016 15:44:52 +0000 (UTC)
commit ad3d4452d61b9fa985ddf0be9840025397e75965
Author: Thomas Haller <thaller redhat com>
Date: Thu May 26 10:57:10 2016 +0200
properties: cache errno in local variable
properties/nm-libreswan-editor-plugin.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/properties/nm-libreswan-editor-plugin.c b/properties/nm-libreswan-editor-plugin.c
index a62e7e6..dcc3308 100644
--- a/properties/nm-libreswan-editor-plugin.c
+++ b/properties/nm-libreswan-editor-plugin.c
@@ -70,12 +70,13 @@ import_from_file (NMVpnEditorPlugin *self,
NMSettingVpn *s_vpn;
GIOChannel *chan;
gchar *str;
- int fd;
+ int fd, errsv;
fd = g_open (path, O_RDONLY, 0777);
if (fd == -1) {
+ errsv = errno;
g_set_error (error, NMV_EDITOR_PLUGIN_ERROR, 0,
- _("Can't open file '%s': %s"), path, g_strerror (errno));
+ _("Can't open file '%s': %s"), path, g_strerror (errsv));
return NULL;
}
@@ -123,12 +124,13 @@ export_to_file (NMVpnEditorPlugin *self,
{
NMSettingVpn *s_vpn;
gboolean openswan = FALSE;
- int fd;
+ int fd, errsv;
fd = g_open (path, O_WRONLY | O_CREAT, 0777);
if (fd == -1) {
+ errsv = errno;
g_set_error (error, NMV_EDITOR_PLUGIN_ERROR, 0,
- _("Can't open file '%s': %s"), path, g_strerror (errno));
+ _("Can't open file '%s': %s"), path, g_strerror (errsv));
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]