Fix crash on Win32 when HOME env is set and no config in cwd. (closes #1)
Bug found by DL6RAI.
This commit is contained in:
parent
9f65e376dd
commit
03096032d8
|
|
@ -1103,12 +1103,12 @@ void readconfig (CWP *cw) {
|
|||
*/
|
||||
|
||||
if ((conf = fopen(cw->configfile, "r")) == NULL) {
|
||||
#if !__MINGW32__
|
||||
/* ebook2cw.conf not in current directory */
|
||||
if ((homedir = getenv("HOME")) == NULL) { /* no home or Windows */
|
||||
return;
|
||||
}
|
||||
#if !__MINGW32__
|
||||
/* Linux/Unix: Look for ~/.ebook2cw/ebook2cw.conf */
|
||||
/* Look for ~/.ebook2cw/ebook2cw.conf */
|
||||
snprintf(cw->configfile, 2048, "%s/.ebook2cw/ebook2cw.conf", homedir);
|
||||
if ((conf = fopen(cw->configfile, "r")) == NULL) {
|
||||
/* Not in ~/.ebook2cw/ either, look for it in
|
||||
|
|
@ -1137,6 +1137,8 @@ void readconfig (CWP *cw) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
return; /* Win32 and no ebook2cw.conf in current dir -> return */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue