diff --git a/src/ChangeLog b/src/ChangeLog
index 56b6eb97..8e9572f2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2011-08-19  Giuseppe Scrivano  <gscrivano@gnu.org>
+
+	* init.c (home_dir) [MSDOS]: Move local variable `len' here.
+
 2011-08-18  Giuseppe Scrivano  <giuseppe@southpole.se>
 
 	* http.c (gethttp): Fix a memory leak on some errors.  Free the head
diff --git a/src/init.c b/src/init.c
index dca24a9f..0389c39f 100644
--- a/src/init.c
+++ b/src/init.c
@@ -370,7 +370,6 @@ home_dir (void)
 {
   static char *buf = NULL;
   static char *home, *ret;
-  int len;
 
   if (!home)
     {
@@ -378,6 +377,8 @@ home_dir (void)
       if (!home)
         {
 #if defined(MSDOS)
+          int len;
+
           /* Under MSDOS, if $HOME isn't defined, use the directory where
              `wget.exe' resides.  */
           const char *_w32_get_argv0 (void); /* in libwatt.a/pcconfig.c */