Patch #494045: patches errno and stat to cope on plan9.
diff --git a/Python/errors.c b/Python/errors.c
index 13b3d11..3869b1c 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -264,6 +264,9 @@
 	PyObject *v;
 	char *s;
 	int i = errno;
+#ifdef PLAN9
+	char errbuf[ERRMAX];
+#endif
 #ifdef MS_WIN32
 	char *s_buf = NULL;
 #endif
@@ -271,6 +274,10 @@
 	if (i == EINTR && PyErr_CheckSignals())
 		return NULL;
 #endif
+#ifdef PLAN9
+	rerrstr(errbuf, sizeof errbuf);
+	s = errbuf;
+#else
 	if (i == 0)
 		s = "Error"; /* Sometimes errno didn't get set */
 	else
@@ -305,7 +312,8 @@
 				s[--len] = '\0';
 		}
 	}
-#endif
+#endif /* Unix/Windows */
+#endif /* PLAN 9*/
 	if (filename != NULL)
 		v = Py_BuildValue("(iss)", i, s, filename);
 	else