[vte] Preserve errno



commit 47ddb37d3e6900a456a6739ceb6f03ab96f7c1b0
Author: Christian Persch <chpe gnome org>
Date:   Wed Mar 24 21:29:11 2010 +0100

    Preserve errno

 src/pty.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/pty.c b/src/pty.c
index 7ca34d1..9c61ece 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -1112,7 +1112,7 @@ _vte_pty_stop_helper(void)
 static gboolean
 _vte_pty_start_helper(GError **error)
 {
-	int i;
+	int i, errsv;
         int tunnel = -1;
         int tmp[2] = { -1, -1 };
 
@@ -1175,10 +1175,12 @@ _vte_pty_start_helper(GError **error)
 	return TRUE;
 
 failure:
+        errsv = errno;
+
         g_set_error(error, VTE_PTY_ERROR,
                     VTE_PTY_ERROR_PTY_HELPER_FAILED,
                     "Failed to start gnome-pty-helper: %s",
-                    g_strerror (errno));
+                    g_strerror (errsv));
 
         if (tmp[0] != -1)
                 close(tmp[0]);
@@ -1190,6 +1192,7 @@ failure:
         _vte_pty_helper_pid = -1;
         _vte_pty_helper_tunnel = -1;
 
+        errno = errsv;
         return FALSE;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]