[vte] Work harder to preserve errno



commit cb7b31e70e34b7af4162fd28b947678c31609819
Author: Christian Persch <chpe gnome org>
Date:   Wed Mar 17 22:37:41 2010 +0100

    Work harder to preserve errno

 src/pty.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/pty.c b/src/pty.c
index 453c01e..15cb935 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -724,7 +724,7 @@ _vte_pty_ptsname(int master)
 #if defined(HAVE_PTSNAME_R)
 	gsize len = 1024;
 	char *buf = NULL;
-	int i;
+	int i, errsv;
 	do {
 		buf = g_malloc0(len);
 		i = ptsname_r(master, buf, len - 1);
@@ -736,7 +736,9 @@ _vte_pty_ptsname(int master)
 			return buf;
 			break;
 		default:
+                        errsv = errno;
 			g_free(buf);
+                        errno = errsv;
 			buf = NULL;
 			break;
 		}



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