Higuchi-san,

On Mon, Sep 10, 2018 at 03:44:54PM +0900, Michael Paquier wrote:
> Yes, the fix needs to happen there.  It seems to me that what we are
> looking for here is to complete the calculation of st_size with
> nFileSizeHigh, so as we are able to compile a correct 64-bit integer
> size, allowing support for larger files on Win32, which is something
> that fsync() support for pg_dump has actually changed by opening stat()
> to be called for files with a size larger than 4GB.  (I need badly to
> setup a Windows machine...)

Does something like the patch attached help?  This makes sure that
st_size is set correctly for files with a size larger than 4GB.
Unfortunately I have not been able to test it, I have tried for some
time today to deploy a Win10 VM with VS 2017 (community version), but I
cannot get past some errors because of a set of missing files when
trying to compile, the one build complains about is Platform.targets,
which goes missing even if vc_redist is installed for all the C++
deliverables.  The user experience has gotten worse lately, at least for
me..
--
Michael
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index 26611922db..3ee9d953c7 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -395,11 +395,8 @@ pgwin32_safestat(const char *path, struct stat *buf)
 		return -1;
 	}
 
-	/*
-	 * XXX no support for large files here, but we don't do that in general on
-	 * Win32 yet.
-	 */
-	buf->st_size = attr.nFileSizeLow;
+	/* note that this supports files larger than 4GB */
+	buf->st_size = ((off_t) attr.nFileSizeHigh) << 32 | attr.nFileSizeLow;
 
 	return 0;
 }

Attachment: signature.asc
Description: PGP signature

Reply via email to