I'm submitting this patch which Windows users have confirmed fixes a bug
where tempfiles are not deleted.  This was caused by failing to initialise 
the argument to GetVersionEx, like the MS documentation mandates.

It seems that there are two identical copies (with the identical bug) of
supports_delete_on_close in gnulib, one in clean-temp.c and the other in
tmpfile.c  However this patch fixes only the former, because the latter
we don't use, and I know you guys don't like fixes for bugs until they've
actually been reported to cause a problem to end users (but my recommendation
FWIW would be to refactor these two functions into a single public one).

J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://keys.gnupg.net or any PGP keyserver for public key.

From 3ef7143dbea4cf49c5629030d76c0766276562fd Mon Sep 17 00:00:00 2001
From: John Darrington <j...@darrington.wattle.id.au>
Date: Tue, 19 Jun 2012 18:26:55 +0200
Subject: [PATCH] supports_delete_on_close: Initialise OSVIERSIONINFO struct per documentation

The microsoft documentation says that dwOSVersionInfoSize must be initialised
with the size of the struct.  This was not being done, so the call
to GetVersionEx was failing.
---
 gl/clean-temp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gl/clean-temp.c b/gl/clean-temp.c
index b05550a..362acff 100644
--- a/gl/clean-temp.c
+++ b/gl/clean-temp.c
@@ -583,6 +583,10 @@ supports_delete_on_close ()
     {
       OSVERSIONINFO v;
 
+      /* according to http://msdn.microsoft.com/en-us/library/windows/desktop/ms724451%28v=vs.85%29.aspx 
+	 this structure must be initialised as follows:   */
+      v.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
+
       if (GetVersionEx (&v))
         known = (v.dwPlatformId == VER_PLATFORM_WIN32_NT ? 1 : -1);
       else
-- 
1.7.2.5

Attachment: signature.asc
Description: Digital signature

Reply via email to