Fabian Greffrath wrote:

> Am 31.05.2011 11:16, schrieb Gary Johnson:
> > Under what conditions does yours crash?
> 
> Plain vim.exe from MSYS executed in a cmd.exe shell.
> 
> I have seen something similar to your observations: If I unset HOME in 
> cmd.exe (via "set HOME=") and then run vim.exe from MSYS, it crashes. 
> If I first run bash and then start vim.exe from bash, it works, even 
> if bash also has its HOME variable unset. Strange...
> 
> However, currently the init_homedir function in misc1.c does not 
> consider the case when both UNIX is defined at build time (#ifdef 
> UNIX) but (var == NULL) at run time, which is perfectly possible when 
> vim is compiled in an MSYS environment (which has __unix defined) but 
> executed from a cmd.exe shell without a HOME variable.
> 
> The attached short patch is very pragmatic but at least provides a 
> fallback solution when the aforementioned case occures, else the 
> init_homedir function may return and the homedir variable is still NULL.

It's perfectly OK for homedir to be NULL.  Setting it to any random
directory is not a good idea.

Where does Vim crash when homedir is NULL?  That should be fixed.

-- 
All true wisdom is found on T-shirts.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui