I did compiled xrdp (CVS version) on my hppa/PARISC Linux box (see:
http://www.parisc-linux.org).
When starting xrdp, it failed with:
        endian wrong, edit arch.h
This error message is even correct, since PARISC is big-endian,
while the source code was somehow miscompiled as little-endian.

The following patch does fix xrdp for me on PARISC Linux.

First, in arch.h, the autodetection of the endianess by the value
of __BYTE_ORDER doesn't work, if __BYTE_ORDER hasn't been defined
yet. My first part of the patch fixes this by #including <endian.h>
on Linux architectures if __BYTE_ORDER wasn't defined yet.
I assume this patch will fix other (big-endian) Linux builds too.

The second part of my patch is a little more special.
All Linux platforms/architectures normally have EAGAIN and
EWOULDBLOCK error codes #defined to the same value.
AFAIK, there is only one exception, which is PARISC-Linux.
PARISC-Linux needs to keep compatibility to HP-UX, which has
different values for EAGAIN and EWOULDBLOCK as well.
The different values do break xrdp, since it was only testing for
EWOULDBLOCK, although the Linux kernel on PARISC-Linux just returns
EAGAIN instead.
Testing for both return codes fixed this for me (and will for HP-UX as
well).
On platforms where EAGAIN and EWOULDBLOCK refer to the same value,
the compiler will usually just optimize out the test for EAGAIN.

It would be nice, if you could apply this patch to CVS head.

Thanks,
Helge



diff -up ./common/arch.h.orig ./common/arch.h
--- ./common/arch.h.orig        2010-02-18 22:07:34.000000000 +0100
+++ ./common/arch.h     2010-02-18 22:10:07.000000000 +0100
@@ -25,6 +25,9 @@
 #define ARCH_H
 
 /* check endianess */
+#if !defined(__BYTE_ORDER) && defined(__linux__)
+#include <endian.h>
+#endif
 #if defined(__sparc__) || defined(__PPC__) || defined(__ppc__)
 #define B_ENDIAN
 #elif defined(__BYTE_ORDER)
diff -up ./common/os_calls.c.orig ./common/os_calls.c
--- ./common/os_calls.c.orig    2010-02-18 22:07:34.000000000 +0100
+++ ./common/os_calls.c 2010-02-18 22:10:07.000000000 +0100
@@ -492,7 +492,7 @@ g_tcp_last_error_would_block(int sck)
 #if defined(_WIN32)
   return WSAGetLastError() == WSAEWOULDBLOCK;
 #else
-  return (errno == EWOULDBLOCK) || (errno == EINPROGRESS);
+  return (errno == EWOULDBLOCK) || (errno == EAGAIN) || (errno == EINPROGRESS);
 #endif
 }
 

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
xrdp-devel mailing list
xrdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xrdp-devel

Reply via email to