From da9949f462515ece4827c531003afdc645393567 Mon Sep 17 00:00:00 2001 From: Matt Wells Date: Fri, 19 Feb 2016 08:54:48 -0800 Subject: [PATCH] try to fix a couple more core dumps. --- RdbList.cpp | 7 +++++-- Tagdb.cpp | 12 ++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/RdbList.cpp b/RdbList.cpp index fd7d6532d..dea9d5b99 100644 --- a/RdbList.cpp +++ b/RdbList.cpp @@ -1686,9 +1686,12 @@ void RdbList::merge_r ( RdbList **lists , // did they call prepareForMerge()? if ( m_mergeMinListSize == -1 ) { log(LOG_LOGIC,"db: rdblist: merge_r: prepareForMerge() not " - "called."); + "called. ignoring error and returning emtpy list."); + // this happens if we nuke doledb during a merge of it. it + // is just bad timing + return; // save state and dump core, sigBadHandler will catch this - char *p = NULL; *p = 0; + //char *p = NULL; *p = 0; } // already there? if ( minRecSizes >= 0 && m_listSize >= minRecSizes ) return; diff --git a/Tagdb.cpp b/Tagdb.cpp index 519e237fd..baee10253 100644 --- a/Tagdb.cpp +++ b/Tagdb.cpp @@ -2603,7 +2603,7 @@ bool Msg8a::getTagRec ( Url *url , // . msge0 passes this in as NULL an expects us to figure it out // . if site was NULL that means we guess it. default to hostname // unless in a recognized for like /~mwells/ - if ( ! site ) { + if ( ! site || siteLen <= 0 ) { SiteGetter sg; sg.getSite ( url->getUrl() , NULL , // tagrec @@ -2622,11 +2622,19 @@ bool Msg8a::getTagRec ( Url *url , // if provided site was NULL and not of a ~mwells type of form // then default it to hostname - if ( ! site ) { + if ( ! site || siteLen <= 0 ) { site = url->getHost(); siteLen = url->getHostLen(); } + // if still the host is bad, then forget it + if ( ! site || siteLen <= 0 ) { + log("tagdb: got bad url with no site"); + m_errno = EBADURL; + g_errno = EBADURL; + return true; + } + // temp null terminate it char c = site[siteLen]; site[siteLen] = '\0';