Welcome! Log In Create A New Profile

Advanced

[PATCH 2 of 2] Win32: extended ngx_random range to 0x7fffffff

J Carter
December 09, 2023 03:02AM
# HG changeset patch
# User J Carter <jordanc.carter@outlook.com>
# Date 1702101635 0
# Sat Dec 09 06:00:35 2023 +0000
# Node ID 1a77698f82d2580aa8b8f62ce89b4dbb6d678c5d
# Parent d9275e982a7188a1ea7855295ffa93362ea9830f
Win32: extended ngx_random range to 0x7fffffff

rand() is used on win32. RAND_MAX is implementation defined. win32's is
0x7fff.

Existing uses of ngx_random rely upon 0x7fffffff range provided by
posix implementations of random().

diff -r d9275e982a71 -r 1a77698f82d2 src/os/win32/ngx_win32_config.h
--- a/src/os/win32/ngx_win32_config.h Sat Dec 09 05:09:07 2023 +0000
+++ b/src/os/win32/ngx_win32_config.h Sat Dec 09 06:00:35 2023 +0000
@@ -280,7 +280,9 @@

#define NGX_HAVE_GETADDRINFO 1

-#define ngx_random rand
+#define ngx_random \
+ ((rand() << 16) | (rand() << 1) | (rand() >> 14))
+
#define ngx_debug_init()


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 2 of 2] Win32: extended ngx_random range to 0x7fffffff

J Carter 396 December 09, 2023 03:02AM

Re: [PATCH 2 of 2] Win32: extended ngx_random range to 0x7fffffff

J Carter 120 December 09, 2023 03:44AM

Re: [PATCH 2 of 2] Win32: extended ngx_random range to 0x7fffffff

Maxim Dounin 105 December 15, 2023 09:58PM

Re: [PATCH 2 of 2] Win32: extended ngx_random range to 0x7fffffff

J Carter 121 December 16, 2023 01:30AM

Re: [PATCH 2 of 2] Win32: extended ngx_random range to 0x7fffffff

Sergey Kandaurov 111 December 21, 2023 08:38AM

Re: [PATCH 2 of 2] Win32: extended ngx_random range to 0x7fffffff

Maxim Dounin 93 December 21, 2023 11:16AM

Re: [PATCH 2 of 2] Win32: extended ngx_random range to 0x7fffffff

Sergey Kandaurov 98 December 22, 2023 08:54AM

Re: [PATCH 2 of 2] Win32: extended ngx_random range to 0x7fffffff

Maxim Dounin 164 December 22, 2023 04:32PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 159
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready