summaryrefslogtreecommitdiff
path: root/filesystems/ltfs/patches/patch-src_ltfs_fuse.c
blob: 55c6e4b7c2bd5ade18a0f8e176d41070f9224884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$NetBSD: patch-src_ltfs_fuse.c,v 1.1 2022/03/24 16:35:31 manu Exp $

Do not take for granted that __WORDSIZE is defined to distinguish 
between 32 and 64 bit platforms. Instead use ULONG_MAX from <limits.h>
which is mandared by ISO C99.

--- src/ltfs_fuse.c.orig	2022-03-24 10:08:47.455171288 +0100
+++ src/ltfs_fuse.c	2022-03-24 10:21:27.627832669 +0100
@@ -53,8 +53,11 @@
 **                  piste@jp.ibm.com
 **
 *************************************************************************************
 */
+
+#include <limits.h> /* for ULONG_MAX */
+
 #include "ltfs_fuse.h"
 #include "libltfs/ltfs_fsops.h"
 #include "libltfs/iosched.h"
 #include "libltfs/pathname.h"
@@ -67,9 +70,9 @@
 #ifdef mingw_PLATFORM
 #include "libltfs/arch/win/win_util.h"
 #endif
 
-#if (__WORDSIZE == 64)
+#if (__WORDSIZE == 64 || ULONG_MAX == 0xffffffffffffffffUL)
 #define FILEHANDLE_TO_STRUCT(fh) ((struct ltfs_file_handle *)(uint64_t)(fh))
 #define STRUCT_TO_FILEHANDLE(de) ((uint64_t)(de))
 #else
 #define FILEHANDLE_TO_STRUCT(fh) ((struct ltfs_file_handle *)(uint32_t)(fh))