From 27239c637271a45793a12a85e66b366c37cbc28c Mon Sep 17 00:00:00 2001
From: Christopher Faylor <me@cgf.cx>
Date: Wed, 9 Feb 2011 15:46:00 +0000
Subject: [PATCH] * hookapi.cc (hook_or_detect_cygwin): Prevent i from being
 considered uninitialized by gcc.

---
 winsup/cygwin/ChangeLog  | 5 +++++
 winsup/cygwin/hookapi.cc | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index d645957ba..8642b762d 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-09  Christopher Faylor  <me+cygwin@cgf.cx>
+
+	* hookapi.cc (hook_or_detect_cygwin): Prevent i from being considered
+	uninitialized by gcc.
+
 2011-02-09  Christopher Faylor  <me+cygwin@cgf.cx>
 
 	* exception.h: Remove DEBUG_EXCEPTION left over debugging ifdef.
diff --git a/winsup/cygwin/hookapi.cc b/winsup/cygwin/hookapi.cc
index 7a13ee047..46df84701 100644
--- a/winsup/cygwin/hookapi.cc
+++ b/winsup/cygwin/hookapi.cc
@@ -252,7 +252,7 @@ hook_or_detect_cygwin (const char *name, const void *fn, WORD& subsys)
   fh.origfn = NULL;
   fh.hookfn = fn;
   char *buf = (char *) alloca (strlen (name) + sizeof ("_64"));
-  int i;
+  int i = 0;
   // Iterate through each import descriptor, and redirect if appropriate
   for (PIMAGE_IMPORT_DESCRIPTOR pd = pdfirst; pd->FirstThunk; pd++)
     {