Commit bede4ad3 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Contribs: try to fix CDDB crash on Windows

Ref #3804
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 3ea13440
......@@ -1473,6 +1473,7 @@ libcddb: libcddb-$(CDDB_VERSION).tar.bz2
ifdef HAVE_WIN32
(cd $@; patch -p0 < ../Patches/libcddb-win32.patch )
endif
patch -p0 < Patches/libcddb-getenv-crash.patch
(cd $@; autoreconf -fisv)
ifdef HAVE_WIN32
......
--- libcddb/lib/cddb_conn.c 2006-10-15 13:53:11.000000000 +0200
+++ libcddb.new/lib/cddb_conn.c 2010-11-28 21:03:39.012749230 +0100
@@ -100,9 +100,17 @@
c->use_cache = CACHE_ON;
/* construct cache dir '$HOME/[DEFAULT_CACHE]' */
s = getenv("HOME");
- c->cache_dir = (char*)malloc(strlen(s) + 1 + sizeof(DEFAULT_CACHE) + 1);
- sprintf(c->cache_dir, "%s/%s", s, DEFAULT_CACHE);
- c->cache_read = FALSE;
+ if( s )
+ {
+ c->cache_dir = (char*)malloc(strlen(s) + 1 + sizeof(DEFAULT_CACHE) + 1);
+ sprintf(c->cache_dir, "%s/%s", s, DEFAULT_CACHE);
+ c->cache_read = FALSE;
+ }
+ else
+ {
+ c->cache_dir = NULL;
+ c->use_cache = CACHE_OFF;
+ }
/* use anonymous@localhost */
c->user = strdup(DEFAULT_USER);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment