[master] d05d20e08 Tolerate when endian.h is symlink to sys/endian.h

Nils Goroll nils.goroll at uplex.de
Mon Nov 18 14:32:05 UTC 2024


commit d05d20e08b3c6435afbecee329d9171105f25652
Author: Kirill A. Korinsky <kirill at korins.ky>
Date:   Thu Nov 7 17:58:08 2024 +0100

    Tolerate when endian.h is symlink to sys/endian.h
    
    Since 5a60b36fe9b45b68244596d93db2b922d53e7b5c varnish drop support of
    sys/endian.h and they had a bit different API one or two leading `_`.
    
    Some system may have symlink from endian.h to sys/endian.h, for example
    OpenBSD. On such system build fails due to wrong SHA256 hash.

diff --git a/lib/libvarnish/vsha256.c b/lib/libvarnish/vsha256.c
index 7e55ec3ad..29f97fe40 100644
--- a/lib/libvarnish/vsha256.c
+++ b/lib/libvarnish/vsha256.c
@@ -33,8 +33,16 @@
 
 #ifndef __DARWIN_BYTE_ORDER
 #  include <endian.h>
-#  define VBYTE_ORDER	__BYTE_ORDER
-#  define VBIG_ENDIAN	__BIG_ENDIAN
+#  ifdef _BYTE_ORDER
+#    define VBYTE_ORDER	_BYTE_ORDER
+#  else
+#    define VBYTE_ORDER	__BYTE_ORDER
+#  endif
+#  ifdef _BIG_ENDIAN
+#    define VBIG_ENDIAN	_BIG_ENDIAN
+#  else
+#    define VBIG_ENDIAN	__BIG_ENDIAN
+#  endif
 #else
 #  define VBYTE_ORDER	__DARWIN_BYTE_ORDER
 #  define VBIG_ENDIAN	__DARWIN_BIG_ENDIAN


More information about the varnish-commit mailing list