[PATCH] Win32: fix unique file index calculations
Piotr Sikora
piotr at aviatrix.com
Wed Feb 28 01:25:15 UTC 2024
# HG changeset patch
# User Piotr Sikora <piotr at aviatrix.com>
# Date 1708977635 0
# Mon Feb 26 20:00:35 2024 +0000
# Branch patch012
# Node ID 04e3155b3b9651fee708898aaf82ac35532806ee
# Parent 9b57470dc49f8d8d10abe30a5df628732d7618dc
Win32: fix unique file index calculations.
The old code was breaking strict aliasing rules.
Signed-off-by: Piotr Sikora <piotr at aviatrix.com>
diff -r 9b57470dc49f -r 04e3155b3b96 src/os/win32/ngx_files.h
--- a/src/os/win32/ngx_files.h Mon Feb 26 20:00:33 2024 +0000
+++ b/src/os/win32/ngx_files.h Mon Feb 26 20:00:35 2024 +0000
@@ -154,7 +154,8 @@
(((off_t) (fi)->nFileSizeHigh << 32) | (fi)->nFileSizeLow)
#define ngx_file_fs_size(fi) ngx_file_size(fi)
-#define ngx_file_uniq(fi) (*(ngx_file_uniq_t *) &(fi)->nFileIndexHigh)
+#define ngx_file_uniq(fi) \
+ (((ngx_file_uniq_t) (fi)->nFileIndexHigh << 32) | (fi)->nFileIndexLow)
/* 116444736000000000 is commented in src/os/win32/ngx_time.c */
More information about the nginx-devel
mailing list