summaryrefslogtreecommitdiffstats
path: root/openbsd-compat/getrrsetbyname.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2022-02-25 09:47:48 +0100
committerDarren Tucker <dtucker@dtucker.net>2022-02-25 09:47:48 +0100
commit0132056efabc5edb85c3c7105d2fb6dee41843c6 (patch)
treecf453fc1e64e87160f5e7a274272da5a37e78a01 /openbsd-compat/getrrsetbyname.c
parentConstify utimes in compat library to match specs. (diff)
downloadopenssh-0132056efabc5edb85c3c7105d2fb6dee41843c6.tar.xz
openssh-0132056efabc5edb85c3c7105d2fb6dee41843c6.zip
Improve handling of _getshort and _getlong.
If the system native ones are exactly as required then use them, otherwise use the local versions mapped to another name to prevent name collisions.
Diffstat (limited to '')
-rw-r--r--openbsd-compat/getrrsetbyname.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/openbsd-compat/getrrsetbyname.c b/openbsd-compat/getrrsetbyname.c
index caadceb64..cc1f8ae51 100644
--- a/openbsd-compat/getrrsetbyname.c
+++ b/openbsd-compat/getrrsetbyname.c
@@ -110,10 +110,17 @@ struct __res_state _res;
#endif
/*
+ * If the system doesn't have _getshort/_getlong or that are not exactly what
+ * we need then use local replacements, avoiding name collisions.
+ */
+#if !defined(HAVE__GETSHORT) || !defined(HAVE__GETLONG) || \
+ !defined(HAVE_DECL__GETSHORT) || HAVE_DECL__GETSHORT == 0 || \
+ !defined(HAVE_DECL__GETLONG) || HAVE_DECL__GETLONG == 0
+#define _getshort(x) (_ssh_compat_getshort(x))
+#define _getlong(x) (_ssh_compat_getlong(x))
+/*
* Routines to insert/extract short/long's.
*/
-
-#ifndef HAVE__GETSHORT
static u_int16_t
_getshort(const u_char *msgp)
{
@@ -122,11 +129,7 @@ _getshort(const u_char *msgp)
GETSHORT(u, msgp);
return (u);
}
-#elif defined(HAVE_DECL__GETSHORT) && (HAVE_DECL__GETSHORT == 0)
-u_int16_t _getshort(const u_char *);
-#endif
-#ifndef HAVE__GETLONG
static u_int32_t
_getlong(const u_char *msgp)
{
@@ -135,8 +138,6 @@ _getlong(const u_char *msgp)
GETLONG(u, msgp);
return (u);
}
-#elif defined(HAVE_DECL__GETLONG) && (HAVE_DECL__GETLONG == 0)
-u_int32_t _getlong(const u_char *);
#endif
/* ************** */