From 6261aa3c0c6ab2956227ff8a0bca3ef51b9a1eac Mon Sep 17 00:00:00 2001 From: CodingKoopa Date: Fri, 8 Mar 2024 06:18:29 +0000 Subject: [PATCH] win32_io.c: switch to _get_osfhandle from get_osfhandle _get_osfhandle is what is documented. The alternative might have been removed. Fixes linker error: /cygdrive/e/Documents/Programs/ntfs-3g/libntfs-3g/win32_io.c:1990:(.text+0x21a5): undefined reference to `get_osfhandle' /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: .libs/libntfs_3g_la-win32_io.o: in function `ntfs_win32_ftruncate': /cygdrive/e/Documents/Programs/ntfs-3g/libntfs-3g/win32_io.c:2054:(.text+0x223a): undefined reference to `get_osfhandle' --- libntfs-3g/win32_io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libntfs-3g/win32_io.c b/libntfs-3g/win32_io.c index b1422603..75e7b3be 100644 --- a/libntfs-3g/win32_io.c +++ b/libntfs-3g/win32_io.c @@ -180,7 +180,7 @@ typedef unsigned long long ULONG_PTR; /* an integer the same size as a pointer * typedef unsigned long ULONG_PTR; /* an integer the same size as a pointer */ #endif -HANDLE get_osfhandle(int); /* from msvcrt.dll */ +HANDLE _get_osfhandle(int); /* from msvcrt.dll */ /* * A few needed definitions not included in @@ -1987,7 +1987,7 @@ int ntfs_win32_set_sparse(int fd) HANDLE handle; DWORD bytes; - handle = get_osfhandle(fd); + handle = _get_osfhandle(fd); if (handle == INVALID_HANDLE_VALUE) ok = FALSE; else @@ -2051,7 +2051,7 @@ int ntfs_win32_ftruncate(int fd, s64 size) int ret; HANDLE handle; - handle = get_osfhandle(fd); + handle = _get_osfhandle(fd); ret = win32_ftruncate(handle, size); return (ret); }