]>
Commit | Line | Data |
---|---|---|
e5fd101c PS |
1 | autofs-5.0.4 - srv lookup handle endianness |
2 | ||
3 | From: Ian Kent <raven@themaw.net> | |
4 | ||
5 | ||
6 | --- | |
7 | ||
8 | modules/dclist.c | 6 ++++++ | |
9 | 1 files changed, 6 insertions(+), 0 deletions(-) | |
10 | ||
11 | ||
12 | diff --git a/modules/dclist.c b/modules/dclist.c | |
13 | index 5b0e577..967581c 100644 | |
14 | --- a/modules/dclist.c | |
15 | +++ b/modules/dclist.c | |
16 | @@ -34,6 +34,7 @@ | |
17 | #include <ldap.h> | |
18 | #include <sys/param.h> | |
19 | #include <errno.h> | |
20 | +#include <endian.h> | |
21 | ||
22 | #include "automount.h" | |
23 | #include "dclist.h" | |
24 | @@ -72,8 +73,13 @@ | |
25 | #define SVAL(buf, pos) (*(const uint16_t *)((const char *)(buf) + (pos))) | |
26 | #define IVAL(buf, pos) (*(const uint32_t *)((const char *)(buf) + (pos))) | |
27 | ||
28 | +#if __BYTE_ORDER == __LITTLE_ENDIAN | |
29 | #define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) | |
30 | #define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16))) | |
31 | +#else | |
32 | +#define SREV(x) (x) | |
33 | +#define IREV(x) (x) | |
34 | +#endif | |
35 | ||
36 | #define RSVAL(buf, pos) SREV(SVAL(buf, pos)) | |
37 | #define RIVAL(buf, pos) IREV(IVAL(buf, pos)) |