aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/src
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-10-04 21:01:59 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-11-01 16:19:54 +0100
commita7355c5c8ab9c013f4f0a75175a718ee3f4e970a (patch)
tree2c62a1e324c6169a844adf19d137228ee517ab9f /nx-X11/lib/src
parente721ba296dc2a7180c2fd7aa81cd0bcd090dfd23 (diff)
downloadnx-libs-a7355c5c8ab9c013f4f0a75175a718ee3f4e970a.tar.gz
nx-libs-a7355c5c8ab9c013f4f0a75175a718ee3f4e970a.tar.bz2
nx-libs-a7355c5c8ab9c013f4f0a75175a718ee3f4e970a.zip
Xau: mark NX changes
libXau is integrated into libNX_X11, but the differences to libXau original code where not explicitly marked. This path adds some ifdefs and also restores the original code. Attributes to ArcticaProject/nx-libs#850
Diffstat (limited to 'nx-X11/lib/src')
-rw-r--r--nx-X11/lib/src/AuRead.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/nx-X11/lib/src/AuRead.c b/nx-X11/lib/src/AuRead.c
index 61814792d..5c04c3258 100644
--- a/nx-X11/lib/src/AuRead.c
+++ b/nx-X11/lib/src/AuRead.c
@@ -30,13 +30,16 @@ in this Software without prior written authorization from The Open Group.
#endif
#include <nx-X11/Xauth.h>
#include <stdlib.h>
+#ifdef NX_TRANS_SOCKET
#include <errno.h>
+#endif
static int
read_short (unsigned short *shortp, FILE *file)
{
unsigned char file_short[2];
+#ifdef NX_TRANS_SOCKET
/*
* Added a check on EINTR to prevent the fread() call to be
* interrupted by any signal not blocked by OsBlockSignals().
@@ -53,6 +56,10 @@ read_short (unsigned short *shortp, FILE *file)
}
break;
}
+#else
+ if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
+ return 0;
+#endif
*shortp = file_short[0] * 256 + file_short[1];
return 1;
}
@@ -71,6 +78,7 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file)
data = malloc ((unsigned) len);
if (!data)
return 0;
+#ifdef NX_TRANS_SOCKET
for (;;)
{
if (fread (data, (int) sizeof (char), (int) len, file) != len)
@@ -87,6 +95,13 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file)
}
break;
}
+#else
+ if (fread (data, (int) sizeof (char), (int) len, file) != len) {
+ bzero (data, len);
+ free (data);
+ return 0;
+ }
+#endif
}
*stringp = data;
*countp = len;