From: Amos Jeffries Date: Sat, 8 Feb 2014 13:36:42 +0000 (-0700) Subject: Source Maintenance - manual run X-Git-Tag: SQUID_3_5_0_1~382 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=86c631902cc135b03ff6f53dc958da06e8ae7d39;p=thirdparty%2Fsquid.git Source Maintenance - manual run --- diff --git a/compat/os/mswindows.h b/compat/os/mswindows.h index cdc53dc507..c63fe73ec2 100644 --- a/compat/os/mswindows.h +++ b/compat/os/mswindows.h @@ -114,7 +114,6 @@ typedef unsigned long ino_t; #define snprintf _snprintf #define stat _stati64 #define strcasecmp _stricmp -#define strdup _strdup #define strlwr _strlwr #define strncasecmp _strnicmp #define tempnam _tempnam diff --git a/helpers/external_acl/AD_group/ext_ad_group_acl.cc b/helpers/external_acl/AD_group/ext_ad_group_acl.cc index 6b5b9219e6..c3d35847d1 100644 --- a/helpers/external_acl/AD_group/ext_ad_group_acl.cc +++ b/helpers/external_acl/AD_group/ext_ad_group_acl.cc @@ -187,7 +187,7 @@ Get_primaryGroup(IADs * pUser) CoTaskMemFree(pByte); *(strrchr(szSID, '-') + 1) = '\0'; - sprintf(tmpSID, "%s%u", szSID, User_primaryGroupID); + snprintf(tmpSID, sizeof(tmpSID)-1, "%s%u", szSID, User_primaryGroupID); wcsize = MultiByteToWideChar(CP_ACP, 0, tmpSID, -1, wc, 0); wc = (wchar_t *) xmalloc(wcsize * sizeof(wchar_t)); diff --git a/helpers/external_acl/kerberos_ldap_group/support_resolv.cc b/helpers/external_acl/kerberos_ldap_group/support_resolv.cc index 8df8fd2fff..aa11112dd0 100644 --- a/helpers/external_acl/kerberos_ldap_group/support_resolv.cc +++ b/helpers/external_acl/kerberos_ldap_group/support_resolv.cc @@ -239,7 +239,7 @@ get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, size_t n if (ls->domain && !strcasecmp(ls->domain, domain)) { debug((char *) "%s| %s: DEBUG: Found lserver@domain %s@%s\n", LogTime(), PROGRAM, ls->lserver, ls->domain); hp = (struct hstruct *) xrealloc(hp, sizeof(struct hstruct) * (nhosts + 1)); - hp[nhosts].host = strdup(ls->lserver); + hp[nhosts].host = xstrdup(ls->lserver); hp[nhosts].port = -1; hp[nhosts].priority = -2; hp[nhosts].weight = -2; @@ -247,7 +247,7 @@ get_ldap_hostname_list(struct main_args *margs, struct hstruct **hlist, size_t n } else if ( !ls->domain || !strcasecmp(ls->domain, "") ) { debug((char *) "%s| %s: DEBUG: Found lserver@domain %s@%s\n", LogTime(), PROGRAM, ls->lserver, ls->domain?ls->domain:"NULL"); hp = (struct hstruct *) xrealloc(hp, sizeof(struct hstruct) * (nhosts + 1)); - hp[nhosts].host = strdup(ls->lserver); + hp[nhosts].host = xstrdup(ls->lserver); hp[nhosts].port = -1; hp[nhosts].priority = -2; hp[nhosts].weight = -2; @@ -401,7 +401,7 @@ finalise: debug("%s| %s: DEBUG: Adding %s to list\n", LogTime(), PROGRAM, domain); hp = (struct hstruct *) xrealloc(hp, sizeof(struct hstruct) * (nhosts + 1)); - hp[nhosts].host = strdup(domain); + hp[nhosts].host = xstrdup(domain); hp[nhosts].port = -1; hp[nhosts].priority = -2; hp[nhosts].weight = -2; diff --git a/lib/profiler/xprof_type.h b/lib/profiler/xprof_type.h index c45378fd69..a7ba32a411 100644 --- a/lib/profiler/xprof_type.h +++ b/lib/profiler/xprof_type.h @@ -71,7 +71,6 @@ typedef enum { XPROF_storeGetMemSpace, XPROF_storeMaintainSwapSpace, XPROF_storeRelease, - XPROF_storeWriteComplete, XPROF_write, XPROF_xcalloc, XPROF_xmalloc, diff --git a/lib/smblib/find_password.c b/lib/smblib/find_password.c index ae31034897..782283f1ca 100644 --- a/lib/smblib/find_password.c +++ b/lib/smblib/find_password.c @@ -97,7 +97,7 @@ char *print_password(char * password) if (((unsigned)password[i] <= ' ') || ((unsigned)password[i] > 127)) { pwd_str[j] = '\\'; - sprintf(temp, "%03i", (int)password[i]); + snprintf(temp, sizeof(temp)-1, "%03i", (int)password[i]); strcpy(&pwd_str[j + 1], temp); j = j + 3; /* Space for \ accounted for below */ @@ -228,7 +228,7 @@ main(int argc, char *argv[]) } - sprintf(service_name, "\\\\%s\\%s", server, service); /* Could blow up */ + sprintf(service_name, sizeof(service_name)-1, "\\\\%s\\%s", server, service); /* Could blow up */ /* Now loop through all password possibilities ... */ diff --git a/lib/smblib/smb-errors.c b/lib/smblib/smb-errors.c index 6813ccdf07..9d30d2ee4e 100644 --- a/lib/smblib/smb-errors.c +++ b/lib/smblib/smb-errors.c @@ -190,7 +190,7 @@ int SMB_Get_SMB_Error_Msg(int err_class, int err_code, char *msg_buf, int len) strncpy(msg_buf, err_classes[i].class, len); strncat(msg_buf, " - ", len - strlen(msg_buf)); - sprintf(internal_buf, "%d", err_code); + snprintf(internal_buf, sizeof(internal_buf)-1, "%d", err_code); strncat(msg_buf, internal_buf, len - strlen(msg_buf)); strncat(msg_buf, " (Unknown error code).", len - strlen(msg_buf)); @@ -200,7 +200,7 @@ int SMB_Get_SMB_Error_Msg(int err_class, int err_code, char *msg_buf, int len) strncpy(msg_buf, err_classes[i].class, len); strncat(msg_buf, " - ", len - strlen(msg_buf)); - sprintf(internal_buf, "%d", err_code); + snprintf(internal_buf, sizeof(internal_buf)-1, "%d", err_code); strncat(msg_buf, internal_buf, len - strlen(msg_buf)); return(strlen(msg_buf)); @@ -211,10 +211,10 @@ int SMB_Get_SMB_Error_Msg(int err_class, int err_code, char *msg_buf, int len) /* If we get here, we did not recognize the error class */ - sprintf(internal_buf, "%d", err_class); + snprintf(internal_buf, sizeof(internal_buf)-1, "%d", err_class); strncat(msg_buf, internal_buf, len - strlen(msg_buf)); strncat(msg_buf, " (Unknown Error Class) - ", len - strlen(msg_buf)); - sprintf(internal_buf, "%d", err_code); + snprintf(internal_buf, sizeof(internal_buf)-1, "%d", err_code); strncat(msg_buf, internal_buf, len - strlen(msg_buf)); strncat(msg_buf, "(error code).", len - strlen(msg_buf)); diff --git a/scripts/source-maintenance.sh b/scripts/source-maintenance.sh index 72c250a00b..97f7c7b485 100755 --- a/scripts/source-maintenance.sh +++ b/scripts/source-maintenance.sh @@ -107,13 +107,14 @@ for FILENAME in `ls -1`; do # # detect functions unsafe for use within Squid. - # strdup() + # strdup() - only allowed in compat/xstring.h which defines a safe replacement. + # sprintf() - not allowed anywhere. # - STRDUP=`grep -e "[^x]strdup" ${FILENAME}`; - if test "x${STRDUP}" != "x" ; then + STRDUP=`grep -e "[^x]strdup(" ${FILENAME}`; + if test "x${STRDUP}" != "x" -a "${FILENAME}" != "xstring.h"; then echo "ERROR: ${PWD}/${FILENAME} contains unprotected use of strdup()" fi - SPRINTF=`grep -e "[^v]sprintf" ${FILENAME}`; + SPRINTF=`grep -e "[^v]sprintf(" ${FILENAME}`; if test "x${SPRINTF}" != "x" ; then echo "ERROR: ${PWD}/${FILENAME} contains unsafe use of sprintf()" fi diff --git a/src/DiskIO/Blocking/BlockingFile.cc b/src/DiskIO/Blocking/BlockingFile.cc index 06ef4231e5..c8c2c99724 100644 --- a/src/DiskIO/Blocking/BlockingFile.cc +++ b/src/DiskIO/Blocking/BlockingFile.cc @@ -46,16 +46,16 @@ CBDATA_CLASS_INIT(BlockingFile); -BlockingFile::BlockingFile(char const *aPath) : fd (-1), closed (true), error_(false) +BlockingFile::BlockingFile(char const *aPath) : fd(-1), closed(true), error_(false) { assert(aPath); debugs(79, 3, "BlockingFile::BlockingFile: " << aPath); - path_ = xstrdup (aPath); + path_ = xstrdup(aPath); } BlockingFile::~BlockingFile() { - safe_free (path_); + safe_free(path_); doClose(); } diff --git a/src/DiskIO/DiskDaemon/DiskdFile.cc b/src/DiskIO/DiskDaemon/DiskdFile.cc index b3e5e57bad..09100de97e 100644 --- a/src/DiskIO/DiskDaemon/DiskdFile.cc +++ b/src/DiskIO/DiskDaemon/DiskdFile.cc @@ -59,16 +59,16 @@ DiskdFile::DiskdFile(char const *aPath, DiskdIOStrategy *anIO) : mode(0), inProgressIOs(0) { - assert (aPath); + assert(aPath); debugs(79, 3, "DiskdFile::DiskdFile: " << aPath); - path_ = xstrdup (aPath); + path_ = xstrdup(aPath); id = diskd_stats.sio_id; ++diskd_stats.sio_id; } DiskdFile::~DiskdFile() { - assert (inProgressIOs == 0); + assert(inProgressIOs == 0); safe_free (path_); } @@ -76,9 +76,9 @@ void DiskdFile::open(int flags, mode_t aMode, RefCount< IORequestor > callback) { debugs(79, 3, "DiskdFile::open: " << this << " opening for " << callback.getRaw()); - assert (ioRequestor.getRaw() == NULL); + assert(ioRequestor.getRaw() == NULL); ioRequestor = callback; - assert (callback.getRaw()); + assert(callback.getRaw()); mode = flags; ssize_t shm_offset; char *buf = (char *)IO->shm.get(&shm_offset); diff --git a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc index fe7a59c286..3ee452e34e 100644 --- a/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc +++ b/src/DiskIO/DiskThreads/DiskThreadsDiskFile.cc @@ -54,14 +54,14 @@ CBDATA_CLASS_INIT(DiskThreadsDiskFile); DiskThreadsDiskFile::DiskThreadsDiskFile(char const *aPath, DiskThreadsIOStrategy *anIO):fd(-1), errorOccured (false), IO(anIO), inProgressIOs (0) { - assert (aPath); + assert(aPath); debugs(79, 3, "UFSFile::UFSFile: " << aPath); - path_ = xstrdup (aPath); + path_ = xstrdup(aPath); } DiskThreadsDiskFile::~DiskThreadsDiskFile() { - safe_free (path_); + safe_free(path_); doClose(); } diff --git a/src/SBufAlgos.h b/src/SBufAlgos.h index 8c34b075f3..8e764d1b31 100644 --- a/src/SBufAlgos.h +++ b/src/SBufAlgos.h @@ -11,7 +11,7 @@ class SBufEqual { public: explicit SBufEqual(const SBuf &reference, SBufCaseSensitive sensitivity = caseSensitive) : - reference_(reference), sensitivity_(sensitivity) {} + reference_(reference), sensitivity_(sensitivity) {} bool operator() (const SBuf & checking) { return checking.compare(reference_,sensitivity_) == 0; } private: SBuf reference_; @@ -23,7 +23,7 @@ class SBufStartsWith { public: explicit SBufStartsWith(const SBuf &prefix, SBufCaseSensitive sensitivity = caseSensitive) : - prefix_(prefix), sensitivity_(sensitivity) {} + prefix_(prefix), sensitivity_(sensitivity) {} bool operator() (const SBuf & checking) { return checking.startsWith(prefix_,sensitivity_); } private: SBuf prefix_; @@ -38,7 +38,7 @@ class SBufAddLength { public: explicit SBufAddLength(const SBuf &separator) : - separatorLen_(separator.length()) {} + separatorLen_(separator.length()) {} SBuf::size_type operator()(const SBuf::size_type sz, const SBuf & item) { return sz + item.length() + separatorLen_; } @@ -68,7 +68,7 @@ SBufContainerJoin(const Container &items, const SBuf& separator) typename Container::const_iterator i(items.begin()); rv.append(*i); ++i; - for (;i != items.end(); ++i) + for (; i != items.end(); ++i) rv.append(separator).append(*i); return rv; } diff --git a/src/SBufDetailedStats.cc b/src/SBufDetailedStats.cc index 52dec38828..0ba27cd57a 100644 --- a/src/SBufDetailedStats.cc +++ b/src/SBufDetailedStats.cc @@ -10,16 +10,16 @@ static StatHist sbufDestructTimeStats; static StatHist memblobDestructTimeStats; -namespace SBufDetailedStatsHistInitializer { - // run the post-instantiation initialization methods for StatHist objects - struct Initializer - { - Initializer() { - sbufDestructTimeStats.logInit(300,30.0,128000.0); - memblobDestructTimeStats.logInit(300,30.0,128000.0); - } - }; - Initializer initializer; +namespace SBufDetailedStatsHistInitializer +{ +// run the post-instantiation initialization methods for StatHist objects +struct Initializer { + Initializer() { + sbufDestructTimeStats.logInit(300,30.0,128000.0); + memblobDestructTimeStats.logInit(300,30.0,128000.0); + } +}; +Initializer initializer; } void diff --git a/src/SBufStatsAction.cc b/src/SBufStatsAction.cc index 2484dd67a2..d585d015aa 100644 --- a/src/SBufStatsAction.cc +++ b/src/SBufStatsAction.cc @@ -67,8 +67,8 @@ SBufStatsAction::dump(StoreEntry* entry) { StoreEntryStream ses(entry); ses << "\n\n\nThese statistics are experimental; their format and contents " - "should not be relied upon, they are bound to change as " - "the SBuf feature is evolved\n"; + "should not be relied upon, they are bound to change as " + "the SBuf feature is evolved\n"; sbdata.dump(ses); mbdata.dump(ses); ses << "\n"; diff --git a/src/acl/CertificateData.cc b/src/acl/CertificateData.cc index d3ed5edf72..16c027d0d3 100644 --- a/src/acl/CertificateData.cc +++ b/src/acl/CertificateData.cc @@ -59,7 +59,7 @@ ACLCertificateData::ACLCertificateData(ACLCertificateData const &old) : attribut validAttributes.assign (old.validAttributes.begin(), old.validAttributes.end()); attributeIsOptional = old.attributeIsOptional; if (old.attribute) - attribute = xstrdup (old.attribute); + attribute = xstrdup(old.attribute); } template diff --git a/src/acl/Gadgets.cc b/src/acl/Gadgets.cc index c96dcf0e47..4c104f249f 100644 --- a/src/acl/Gadgets.cc +++ b/src/acl/Gadgets.cc @@ -53,7 +53,6 @@ #include #include - typedef std::set AclSet; /// Accumulates all ACLs to facilitate their clean deletion despite reuse. static AclSet *RegisteredAcls; // TODO: Remove when ACLs are refcounted diff --git a/src/adaptation/AccessCheck.h b/src/adaptation/AccessCheck.h index 13728e57d9..3a931a8324 100644 --- a/src/adaptation/AccessCheck.h +++ b/src/adaptation/AccessCheck.h @@ -1,8 +1,8 @@ #ifndef SQUID_ADAPTATION__ACCESS_CHECK_H #define SQUID_ADAPTATION__ACCESS_CHECK_H -#include "acl/Acl.h" #include "AccessLogEntry.h" +#include "acl/Acl.h" #include "adaptation/Elements.h" #include "adaptation/forward.h" #include "adaptation/Initiator.h" diff --git a/src/adaptation/ecap/Host.cc b/src/adaptation/ecap/Host.cc index add249c065..42f0d9e7dd 100644 --- a/src/adaptation/ecap/Host.cc +++ b/src/adaptation/ecap/Host.cc @@ -78,7 +78,7 @@ EssentialVersion(const SBuf &raw) // everything after the second period const SBuf::size_type minorPos = raw.find('.'); const SBuf::size_type microPos = minorPos == SBuf::npos ? - SBuf::npos : raw.find('.', minorPos+1); + SBuf::npos : raw.find('.', minorPos+1); return raw.substr(0, microPos); // becomes raw if microPos is npos } diff --git a/src/adaptation/ecap/ServiceRep.cc b/src/adaptation/ecap/ServiceRep.cc index 9c78a45012..bf0a7bb56c 100644 --- a/src/adaptation/ecap/ServiceRep.cc +++ b/src/adaptation/ecap/ServiceRep.cc @@ -2,14 +2,14 @@ * DEBUG: section 93 eCAP Interface */ #include "squid.h" -#include "Debug.h" -#include "EventLoop.h" #include "adaptation/ecap/Config.h" #include "adaptation/ecap/Host.h" #include "adaptation/ecap/ServiceRep.h" #include "adaptation/ecap/XactionRep.h" #include "AsyncEngine.h" #include "base/TextException.h" +#include "Debug.h" +#include "EventLoop.h" #include #include @@ -105,7 +105,7 @@ Adaptation::Ecap::Engine::checkEvents(int) // Start with the default I/O loop timeout, convert from milliseconds. static const struct timeval maxTimeout { EVENT_LOOP_TIMEOUT/1000, // seconds - (EVENT_LOOP_TIMEOUT % 1000)*1000 + (EVENT_LOOP_TIMEOUT % 1000)*1000 }; // microseconds struct timeval timeout = maxTimeout; diff --git a/src/auth/AclMaxUserIp.cc b/src/auth/AclMaxUserIp.cc index 43af041f2c..9e674dcf0d 100644 --- a/src/auth/AclMaxUserIp.cc +++ b/src/auth/AclMaxUserIp.cc @@ -25,7 +25,7 @@ ACLMaxUserIP::ACLMaxUserIP(ACLMaxUserIP const &old) : class_(old.class_), maximum(old.maximum) { - flags = old.flags; + flags = old.flags; } ACLMaxUserIP::~ACLMaxUserIP() diff --git a/src/auth/Config.cc b/src/auth/Config.cc index dba69a7db6..52fc73a0fc 100644 --- a/src/auth/Config.cc +++ b/src/auth/Config.cc @@ -105,10 +105,10 @@ Auth::Config::parse(Auth::Config * scheme, int n_configured, char *param_str) delete keyExtras; keyExtras = nlf; - + if (char *t = strtok(NULL, w_space)) { - debugs(29, DBG_CRITICAL, "FATAL: Unexpected argument '" << t << "' after request_format specification"); - self_destruct(); + debugs(29, DBG_CRITICAL, "FATAL: Unexpected argument '" << t << "' after request_format specification"); + self_destruct(); } } else { debugs(29, DBG_CRITICAL, "Unrecognised " << scheme->type() << " auth scheme parameter '" << param_str << "'"); @@ -126,6 +126,6 @@ void Auth::Config::done() { delete keyExtras; - keyExtras = NULL; + keyExtras = NULL; keyExtrasLine.clean(); } diff --git a/src/auth/Config.h b/src/auth/Config.h index 6f1c981a41..d3cb095c32 100644 --- a/src/auth/Config.h +++ b/src/auth/Config.h @@ -46,7 +46,7 @@ class wordlist; namespace Format { - class Format; +class Format; } namespace Auth diff --git a/src/auth/UserRequest.cc b/src/auth/UserRequest.cc index 5315c7cb4b..e9359acfc7 100644 --- a/src/auth/UserRequest.cc +++ b/src/auth/UserRequest.cc @@ -41,9 +41,9 @@ #include "auth/UserRequest.h" #include "client_side.h" #include "comm/Connection.h" +#include "format/Format.h" #include "HttpReply.h" #include "HttpRequest.h" -#include "format/Format.h" #include "MemBuf.h" /* Generic Functions */ diff --git a/src/auth/basic/UserRequest.cc b/src/auth/basic/UserRequest.cc index a9f6305ec7..aaebbd5de2 100644 --- a/src/auth/basic/UserRequest.cc +++ b/src/auth/basic/UserRequest.cc @@ -6,10 +6,10 @@ #include "auth/State.h" #include "charset.h" #include "Debug.h" +#include "format/Format.h" #include "HelperReply.h" #include "HttpMsg.h" #include "HttpRequest.h" -#include "format/Format.h" #include "MemBuf.h" #include "rfc1738.h" #include "SquidTime.h" diff --git a/src/auth/basic/auth_basic.cc b/src/auth/basic/auth_basic.cc index 8b47206a19..6d00950c9c 100644 --- a/src/auth/basic/auth_basic.cc +++ b/src/auth/basic/auth_basic.cc @@ -289,7 +289,6 @@ Auth::Basic::Config::decode(char const *proxy_auth, const char *aRequestRealm) Tolower(cleartext); local_basic->username(cleartext); - if (local_basic->passwd == NULL) { debugs(29, 4, HERE << "no password in proxy authorization header '" << proxy_auth << "'"); auth_user_request->setDenyMessage("no password was present in the HTTP [proxy-]authorization header. This is most likely a browser bug"); diff --git a/src/auth/digest/UserRequest.cc b/src/auth/digest/UserRequest.cc index 0a4e9452ee..3a199f0046 100644 --- a/src/auth/digest/UserRequest.cc +++ b/src/auth/digest/UserRequest.cc @@ -5,10 +5,10 @@ #include "auth/digest/UserRequest.h" #include "auth/State.h" #include "charset.h" +#include "format/Format.h" #include "HttpHeaderTools.h" #include "HttpReply.h" #include "HttpRequest.h" -#include "format/Format.h" #include "MemBuf.h" #include "SquidTime.h" diff --git a/src/auth/negotiate/UserRequest.cc b/src/auth/negotiate/UserRequest.cc index ed34ff2d63..ee33419bfa 100644 --- a/src/auth/negotiate/UserRequest.cc +++ b/src/auth/negotiate/UserRequest.cc @@ -5,12 +5,12 @@ #include "auth/State.h" #include "auth/User.h" #include "client_side.h" +#include "format/Format.h" #include "globals.h" #include "helper.h" #include "HttpHeaderTools.h" #include "HttpReply.h" #include "HttpRequest.h" -#include "format/Format.h" #include "MemBuf.h" #include "SquidTime.h" diff --git a/src/auth/ntlm/UserRequest.cc b/src/auth/ntlm/UserRequest.cc index 9c6d58c9ee..0f79d5b98f 100644 --- a/src/auth/ntlm/UserRequest.cc +++ b/src/auth/ntlm/UserRequest.cc @@ -5,10 +5,10 @@ #include "auth/State.h" #include "cbdata.h" #include "client_side.h" +#include "format/Format.h" #include "globals.h" #include "HttpMsg.h" #include "HttpRequest.h" -#include "format/Format.h" #include "MemBuf.h" #include "SquidTime.h" diff --git a/src/base/CharacterSet.cc b/src/base/CharacterSet.cc index 563dabb9ac..9202534157 100644 --- a/src/base/CharacterSet.cc +++ b/src/base/CharacterSet.cc @@ -41,16 +41,18 @@ CharacterSet::addRange(unsigned char low, unsigned char high) return *this; } -CharacterSet::CharacterSet(const char *label, const char * const c) -: name(label == NULL ? "anonymous" : label), chars_(Storage(256,0)) +CharacterSet::CharacterSet(const char *label, const char * const c) : + name(label == NULL ? "anonymous" : label), + chars_(Storage(256,0)) { const size_t clen = strlen(c); for (size_t i = 0; i < clen; ++i) add(c[i]); } -CharacterSet::CharacterSet(const char *label, unsigned char low, unsigned char high) -: name(label == NULL ? "anonymous" : label), chars_(Storage(256,0)) +CharacterSet::CharacterSet(const char *label, unsigned char low, unsigned char high) : + name(label == NULL ? "anonymous" : label), + chars_(Storage(256,0)) { addRange(low,high); } diff --git a/src/base/CharacterSet.h b/src/base/CharacterSet.h index 9388003c57..4ab86b32fe 100644 --- a/src/base/CharacterSet.h +++ b/src/base/CharacterSet.h @@ -76,7 +76,7 @@ private: * constructor. This assumption is relied upon in operator[], add, * operator+= */ - Storage chars_; + Storage chars_; }; #endif /* _SQUID_SRC_PARSER_CHARACTERSET_H */ diff --git a/src/client_db.cc b/src/client_db.cc index 62ceb4cc1a..87ab1b2a33 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -123,8 +123,8 @@ clientdbInit(void) class ClientDbRr: public RegisteredRunner { - public: - virtual void run(const RunnerRegistry &); +public: + virtual void run(const RunnerRegistry &); }; RunnerRegistrationEntry(rrAfterConfig, ClientDbRr); diff --git a/src/client_side.cc b/src/client_side.cc index 9fbf9e52a2..dcaa0a6811 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1783,7 +1783,7 @@ ClientSocketContext::pullData() } /** Adapt stream status to account for Range cases - * + * */ clientStream_status_t ClientSocketContext::socketState() @@ -1817,7 +1817,7 @@ ClientSocketContext::socketState() if (bytesSent == bytesExpected) // got everything return STREAM_COMPLETE; - + if (bytesSent > bytesExpected) // Error: Sent more than expected return STREAM_UNPLANNED_COMPLETE; } diff --git a/src/esi/Context.cc b/src/esi/Context.cc index 870c33bd16..32abb96e39 100644 --- a/src/esi/Context.cc +++ b/src/esi/Context.cc @@ -108,7 +108,7 @@ void ESIContext::setErrorMessage(char const *anError) { if (!errormessage) - errormessage = xstrdup (anError); + errormessage = xstrdup(anError); } #endif /* USE_SQUID_ESI == 1 */ diff --git a/src/esi/Include.cc b/src/esi/Include.cc index 120f71beff..7d3f8bfe33 100644 --- a/src/esi/Include.cc +++ b/src/esi/Include.cc @@ -295,10 +295,10 @@ ESIInclude::ESIInclude(ESIInclude const &old) : flags.onerrorcontinue = old.flags.onerrorcontinue; if (old.srcurl) - srcurl = xstrdup (old.srcurl); + srcurl = xstrdup(old.srcurl); if (old.alturl) - alturl = xstrdup (old.alturl); + alturl = xstrdup(old.alturl); } void @@ -353,7 +353,7 @@ ESIInclude::ESIInclude(esiTreeParentPtr aParent, int attrcount, char const **att assert (src.getRaw() == NULL); src = ESIStreamContextNew (this); assert (src.getRaw() != NULL); - srcurl = xstrdup ( attr[i+1]); + srcurl = xstrdup(attr[i+1]); } else if (!strcmp(attr[i],"alt")) { /* Start a secondary request for thisNode url */ /* TODO: make a config parameter to wait on requesting alt's @@ -364,7 +364,7 @@ ESIInclude::ESIInclude(esiTreeParentPtr aParent, int attrcount, char const **att assert (alt.getRaw() == NULL); /* TODO: FIXME */ alt = ESIStreamContextNew (this); assert (alt.getRaw() != NULL); - alturl = xstrdup (attr[i+1]); + alturl = xstrdup(attr[i+1]); } else if (!strcmp(attr[i],"onerror")) { if (!strcmp(attr[i+1], "continue")) { flags.onerrorcontinue = 1; diff --git a/src/esi/VarState.cc b/src/esi/VarState.cc index f43e5b0de2..13e4f73109 100644 --- a/src/esi/VarState.cc +++ b/src/esi/VarState.cc @@ -202,14 +202,14 @@ ESIVariableUserAgent::getProductVersion (char const *s) { char const *t; int len; - t = index (s,'/'); + t = index(s,'/'); if (!t || !*(++t)) - return xstrdup (""); + return xstrdup(""); - len = strcspn (t, " \r\n()<>@,;:\\\"/[]?={}"); + len = strcspn(t, " \r\n()<>@,;:\\\"/[]?={}"); - return xstrndup (t, len + 1); + return xstrndup(t, len + 1); } ESIVariableQuery::ESIVariableQuery(char const *uri) : query (NULL), query_sz (0), query_elements (0), query_string (NULL) @@ -219,11 +219,11 @@ ESIVariableQuery::ESIVariableQuery(char const *uri) : query (NULL), query_sz (0) if (query_start && query_start[1] != '\0' ) { unsigned int n; - query_string = xstrdup (query_start + 1); + query_string = xstrdup(query_start + 1); query_elements = 1; char const *query_pos = query_start + 1; - while ((query_pos = strchr (query_pos, '&'))) { + while ((query_pos = strchr(query_pos, '&'))) { ++query_elements; ++query_pos; } @@ -234,8 +234,8 @@ ESIVariableQuery::ESIVariableQuery(char const *uri) : query (NULL), query_sz (0) n = 0; while (query_pos) { - char const *next = strchr (query_pos, '&'); - char const *div = strchr (query_pos, '='); + char const *next = strchr(query_pos, '&'); + char const *div = strchr(query_pos, '='); if (next) ++next; @@ -249,19 +249,19 @@ ESIVariableQuery::ESIVariableQuery(char const *uri) : query (NULL), query_sz (0) /* zero length between & and = or & and & */ continue; - query[n].var = xstrndup (query_pos, div - query_pos + 1) ; + query[n].var = xstrndup(query_pos, div - query_pos + 1) ; if (div == next) { - query[n].val = xstrdup (""); + query[n].val = xstrdup(""); } else { - query[n].val = xstrndup (div + 1, next - div - 1); + query[n].val = xstrndup(div + 1, next - div - 1); } query_pos = next; ++n; } } else { - query_string = xstrdup (""); + query_string = xstrdup(""); } if (query) { @@ -383,14 +383,14 @@ ESIVariableUserAgent::ESIVariableUserAgent(ESIVarState &state) t = index (t, ' '); if (!t) - browserversion = xstrdup (""); + browserversion = xstrdup(""); else { - t1 = index (t, ';'); + t1 = index(t, ';'); if (!t1) - browserversion = xstrdup (t + 1); + browserversion = xstrdup(t + 1); else - browserversion = xstrndup (t + 1, t1-t); + browserversion = xstrndup(t + 1, t1-t); } } else if (strstr (s, "Mozilla")) { browser = ESI_BROWSER_MOZILLA; @@ -402,7 +402,7 @@ ESIVariableUserAgent::ESIVariableUserAgent(ESIVarState &state) } else { UserOs = ESI_OS_OTHER; browser = ESI_BROWSER_OTHER; - browserversion = xstrdup (""); + browserversion = xstrdup(""); } } diff --git a/src/external_acl.cc b/src/external_acl.cc index 8e858aaedd..95e8a73f9f 100644 --- a/src/external_acl.cc +++ b/src/external_acl.cc @@ -1636,13 +1636,13 @@ ACLExternal::clone() const return new ACLExternal(*this); } -ACLExternal::ACLExternal (char const *theClass) : data (NULL), class_ (xstrdup (theClass)) +ACLExternal::ACLExternal(char const *theClass) : data(NULL), class_(xstrdup(theClass)) {} -ACLExternal::ACLExternal (ACLExternal const & old) : data (NULL), class_ (old.class_ ? xstrdup (old.class_) : NULL) +ACLExternal::ACLExternal(ACLExternal const & old) : data(NULL), class_(old.class_ ? xstrdup(old.class_) : NULL) { /* we don't have copy constructors for the data yet */ - assert (!old.data); + assert(!old.data); } char const * diff --git a/src/format/Format.cc b/src/format/Format.cc index dee57681ae..b90f597e33 100644 --- a/src/format/Format.cc +++ b/src/format/Format.cc @@ -496,7 +496,7 @@ Format::Format::assemble(MemBuf &mb, const AccessLogEntry::Pointer &al, int logS break; case LFT_TIME_START: { - int precision = fmt->widthMax >=0 ? fmt->widthMax : 3; + int precision = fmt->widthMax >=0 ? fmt->widthMax :3; snprintf(tmp, sizeof(tmp), "%0*" PRId64 ".%0*d", fmt->zero && (fmt->widthMin - precision - 1 >= 0) ? fmt->widthMin - precision - 1 : 0, static_cast(al->cache.start_time.tv_sec), precision, (int)(al->cache.start_time.tv_usec / fmt->divisor)); out = tmp; } diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 6f1317d573..a51090f63e 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -501,21 +501,15 @@ doV2Query(int fd, Ip::Address &from, char *buf, icp_common_t header) #endif /* USE_ICMP */ /* The peer is allowed to use this cache */ - ICP2State *state = new ICP2State (header, icp_request); - + ICP2State *state = new ICP2State(header, icp_request); state->fd = fd; - state->from = from; - - state->url = xstrdup (url); - + state->url = xstrdup(url); state->flags = flags; - state->rtt = rtt; - state->src_rtt = src_rtt; - StoreEntry::getPublic (state, url, Http::METHOD_GET); + StoreEntry::getPublic(state, url, Http::METHOD_GET); HTTPMSGUNLOCK(icp_request); } diff --git a/src/icp_v3.cc b/src/icp_v3.cc index 41f87ab6f0..33bd839477 100644 --- a/src/icp_v3.cc +++ b/src/icp_v3.cc @@ -58,7 +58,7 @@ doV3Query(int fd, Ip::Address &from, char *buf, icp_common_t header) { /* We have a valid packet */ char *url = buf + sizeof(icp_common_t) + sizeof(uint32_t); - HttpRequest *icp_request = icpGetRequest (url, header.reqnum, fd, from); + HttpRequest *icp_request = icpGetRequest(url, header.reqnum, fd, from); if (!icp_request) return; @@ -71,12 +71,9 @@ doV3Query(int fd, Ip::Address &from, char *buf, icp_common_t header) /* The peer is allowed to use this cache */ ICP3State *state = new ICP3State (header, icp_request); - state->fd = fd; - state->from = from; - - state->url = xstrdup (url); + state->url = xstrdup(url); StoreEntry::getPublic (state, url, Http::METHOD_GET); } diff --git a/src/ipc/MemMap.cc b/src/ipc/MemMap.cc index 1b6a6a3665..f5d45357f4 100644 --- a/src/ipc/MemMap.cc +++ b/src/ipc/MemMap.cc @@ -237,7 +237,7 @@ hash_key(const unsigned char *data, unsigned int len, unsigned int hashSize) { unsigned int n; unsigned int j; - for(j = 0, n = 0; j < len; j++ ) { + for (j = 0, n = 0; j < len; j++ ) { n ^= 271 * *data; ++data; } @@ -311,7 +311,7 @@ Ipc::MemMapSlot::empty() const /* Ipc::MemMap::Shared */ Ipc::MemMap::Shared::Shared(const int aLimit, const size_t anExtrasSize): - limit(aLimit), extrasSize(anExtrasSize), count(0), slots(aLimit) + limit(aLimit), extrasSize(anExtrasSize), count(0), slots(aLimit) { } diff --git a/src/refresh.cc b/src/refresh.cc index d86a4aa284..4f24301a11 100644 --- a/src/refresh.cc +++ b/src/refresh.cc @@ -223,7 +223,7 @@ refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age, time_t stale_age = static_cast(lastmod_delta * R->pct); debugs(22,3, "Last modified " << lastmod_delta << " sec before we cached it, L-M factor " << - (100.0 * R->pct) << "% = " << stale_age << " sec freshness lifetime"); + (100.0 * R->pct) << "% = " << stale_age << " sec freshness lifetime"); sf->lmfactor = true; if (age >= stale_age) { diff --git a/src/ssl/Config.cc b/src/ssl/Config.cc index f730e03c82..32dd1f3ecd 100644 --- a/src/ssl/Config.cc +++ b/src/ssl/Config.cc @@ -5,10 +5,10 @@ Ssl::Config Ssl::TheConfig; Ssl::Config::Config(): #if USE_SSL_CRTD - ssl_crtd(NULL), + ssl_crtd(NULL), #endif - ssl_crt_validator(NULL) -{ + ssl_crt_validator(NULL) +{ ssl_crt_validator_Children.concurrency = 1; } diff --git a/src/ssl/support.cc b/src/ssl/support.cc index 997d70281e..719fe103d7 100644 --- a/src/ssl/support.cc +++ b/src/ssl/support.cc @@ -41,8 +41,8 @@ #include "acl/FilledChecklist.h" #include "anyp/PortCfg.h" #include "fde.h" -#include "ipc/MemMap.h" #include "globals.h" +#include "ipc/MemMap.h" #include "SquidConfig.h" #include "SquidTime.h" #include "ssl/Config.h" @@ -1694,7 +1694,7 @@ store_session_cb(SSL *ssl, SSL_SESSION *session) unsigned int idlen = session->session_id_length; unsigned char key[MEMMAP_SLOT_KEY_SIZE]; // Session ids are of size 32bytes. They should always fit to a - // MemMap::Slot::key + // MemMap::Slot::key assert(idlen <= MEMMAP_SLOT_KEY_SIZE); memset(key, 0, sizeof(key)); memcpy(key, id, idlen); @@ -1803,7 +1803,7 @@ Ssl::initialize_session_cache() if (!isSslServer()) //no need to configure ssl session cache. return; - // Check if the MemMap keys and data are enough big to hold + // Check if the MemMap keys and data are enough big to hold // session ids and session data assert(SSL_SESSION_ID_SIZE >= MEMMAP_SLOT_KEY_SIZE); assert(SSL_SESSION_MAX_SIZE >= MEMMAP_SLOT_DATA_SIZE); diff --git a/src/tests/Stub.list b/src/tests/Stub.list index b01b39344b..36f7b1e493 100644 --- a/src/tests/Stub.list +++ b/src/tests/Stub.list @@ -1,9 +1,11 @@ STUB_SOURCE= tests/STUB.h \ tests/stub_CacheDigest.cc \ + tests/stub_CollapsedForwarding.cc \ tests/stub_CommIO.cc \ tests/stub_DelayId.cc \ tests/stub_DiskIOModule.cc \ tests/stub_ETag.cc \ + tests/stub_EventLoop.cc \ tests/stub_HelperChildConfig.cc \ tests/stub_HttpReply.cc \ tests/stub_HttpRequest.cc \ @@ -11,6 +13,7 @@ STUB_SOURCE= tests/STUB.h \ tests/stub_MemObject.cc \ tests/stub_MemStore.cc \ tests/stub_Port.cc \ + tests/stub_SBufDetailedStats.cc \ tests/stub_StatHist.cc \ tests/stub_StoreMeta.cc \ tests/stub_SwapDir.cc \ diff --git a/src/tests/stub_EventLoop.cc b/src/tests/stub_EventLoop.cc index 228f4db3ce..4f4626da43 100644 --- a/src/tests/stub_EventLoop.cc +++ b/src/tests/stub_EventLoop.cc @@ -10,4 +10,4 @@ EventLoop::EventLoop(): errcount(0), last_loop(false), timeService(NULL), primaryEngine(NULL), loop_delay(0), error(false), runOnceResult(false) STUB_NOP -void EventLoop::registerEngine(AsyncEngine *engine) STUB + void EventLoop::registerEngine(AsyncEngine *engine) STUB diff --git a/src/tests/stub_libsslsquid.cc b/src/tests/stub_libsslsquid.cc index 85e871dae5..40b3d148b5 100644 --- a/src/tests/stub_libsslsquid.cc +++ b/src/tests/stub_libsslsquid.cc @@ -12,9 +12,9 @@ #include "ssl/Config.h" Ssl::Config::Config(): #if USE_SSL_CRTD - ssl_crtd(NULL), + ssl_crtd(NULL), #endif - ssl_crt_validator(NULL) + ssl_crt_validator(NULL) { ssl_crt_validator_Children.concurrency = 1; STUB_NOP diff --git a/src/tests/testRock.cc b/src/tests/testRock.cc index 3b2e640f7e..da9b757cd5 100644 --- a/src/tests/testRock.cc +++ b/src/tests/testRock.cc @@ -117,17 +117,13 @@ testRock::commonInit() StoreFileSystem::SetupAllFs(); Config.Store.avgObjectSize = 1024; - Config.Store.objectsPerBucket = 20; - Config.Store.maxObjectSize = 2048; Config.store_dir_select_algorithm = xstrdup("round-robin"); Config.replPolicy = new RemovalPolicySettings; - - Config.replPolicy->type = xstrdup ("lru"); - + Config.replPolicy->type = xstrdup("lru"); Config.replPolicy->args = NULL; /* garh garh */ diff --git a/src/tests/testSBuf.cc b/src/tests/testSBuf.cc index 7cf1f05d1c..8cf5e7b1d3 100644 --- a/src/tests/testSBuf.cc +++ b/src/tests/testSBuf.cc @@ -799,7 +799,6 @@ testSBuf::testFindFirstNotOf() CPPUNIT_ASSERT_EQUAL(3U,idx); } - void testSBuf::testAutoFind() { diff --git a/src/tests/testUfs.cc b/src/tests/testUfs.cc index 45fb28be00..84c89fa393 100644 --- a/src/tests/testUfs.cc +++ b/src/tests/testUfs.cc @@ -53,16 +53,13 @@ testUfs::commonInit() return; Config.Store.avgObjectSize = 1024; - Config.Store.objectsPerBucket = 20; - Config.Store.maxObjectSize = 2048; Config.store_dir_select_algorithm = xstrdup("round-robin"); Config.replPolicy = new RemovalPolicySettings; - - Config.replPolicy->type = xstrdup ("lru"); + Config.replPolicy->type = xstrdup("lru"); /* garh garh */ storeReplAdd("lru", createRemovalPolicy_lru); @@ -240,7 +237,7 @@ testUfs::testUfsDefaultEngine() addSwapDir(aStore); commonInit(); Config.replPolicy = new RemovalPolicySettings; - Config.replPolicy->type = xstrdup ("lru"); + Config.replPolicy->type = xstrdup("lru"); mem_policy = createRemovalPolicy(Config.replPolicy); char *path=xstrdup(TESTDIR); diff --git a/src/urn.cc b/src/urn.cc index d888770b51..b907d7ca37 100644 --- a/src/urn.cc +++ b/src/urn.cc @@ -190,9 +190,9 @@ UrnState::createUriResRequest (String &uri) char *host = getHost (uri); snprintf(local_urlres, 4096, "http://%s/uri-res/N2L?urn:" SQUIDSTRINGPH, host, SQUIDSTRINGPRINT(uri)); - safe_free (host); - safe_free (urlres); - urlres = xstrdup (local_urlres); + safe_free(host); + safe_free(urlres); + urlres = xstrdup(local_urlres); urlres_r = HttpRequest::CreateFromUrl(urlres); } diff --git a/test-suite/membanger.c b/test-suite/membanger.c index 19e495301d..d35410a0ec 100644 --- a/test-suite/membanger.c +++ b/test-suite/membanger.c @@ -98,7 +98,7 @@ main(int argc, char **argv) run_stats = atoi(optarg); break; case 'f': - fn = strdup(optarg); + fn = xstrdup(optarg); fp = fopen(fn, "r"); break; case 'i': @@ -291,7 +291,7 @@ const char * make_nam(int id, int size) { const char *buf = malloc(30); /* argh */ - sprintf((char *) buf, "pl:%d/%d", id, size); + snprintf((char *)buf, sizeof(buf)-1, "pl:%d/%d", id, size); return buf; } diff --git a/test-suite/pconn-banger.c b/test-suite/pconn-banger.c index aed8172210..3551ef1046 100644 --- a/test-suite/pconn-banger.c +++ b/test-suite/pconn-banger.c @@ -158,7 +158,7 @@ send_request(int fd, const char *data) struct _r *r; struct _r **R; char *method, *url, *file, *size, *checksum; - char *tmp = strdup(data); + char *tmp = xstrdup(data); struct stat st; int file_fd = -1; method = strtok(tmp, " "); @@ -177,13 +177,13 @@ send_request(int fd, const char *data) if (checksum && strcmp(checksum, "-") == 0) checksum = NULL; msg[0] = '\0'; - sprintf(buf, "%s %s HTTP/1.0\r\n", method, url); + snprintf(buf, sizeof(buf)-1, "%s %s HTTP/1.0\r\n", method, url); strcat(msg, buf); strcat(msg, "Accept: */*\r\n"); strcat(msg, "Proxy-Connection: Keep-Alive\r\n"); if (opt_ims && (lrand48() & 0x03) == 0) { w = time(NULL) - (lrand48() & 0x3FFFF); - sprintf(buf, "If-Modified-Since: %s\r\n", mkrfc850(&w)); + snprintf(buf, sizeof(buf)-1, "If-Modified-Since: %s\r\n", mkrfc850(&w)); strcat(msg, buf); } if (file) { @@ -196,7 +196,7 @@ send_request(int fd, const char *data) close(file_fd); return -1; } - sprintf(buf, "Content-length: %d\r\n", st.st_size); + snprintf(buf, sizeof(buf)-1, "Content-length: %d\r\n", st.st_size); strcat(msg, buf); } strcat(msg, "\r\n"); @@ -557,14 +557,14 @@ char *argv[]; int c; setbuf(stdout, NULL); setbuf(stderr, NULL); - progname = strdup(argv[0]); + progname = xstrdup(argv[0]); while ((c = getopt(argc, argv, "p:h:n:t:icl:r")) != -1) { switch (c) { case 'p': proxy_port = atoi(optarg); break; case 'h': - proxy_addr = strdup(optarg); + proxy_addr = xstrdup(optarg); break; case 'n': max_outstanding = atoi(optarg); diff --git a/test-suite/tcp-banger2.c b/test-suite/tcp-banger2.c index 8de4f3b318..c43d50b6b3 100644 --- a/test-suite/tcp-banger2.c +++ b/test-suite/tcp-banger2.c @@ -329,7 +329,7 @@ request(char *urlin) { checksum = "-"; r = calloc(1, sizeof *r); assert(r != NULL); - r->url = strdup(url); + r->url = xstrdup(url); assert(r->url); strcpy(r->method, method); strcpy(r->requestbodyfile, file); @@ -349,17 +349,17 @@ request(char *urlin) { } else { host = NULL; } - sprintf(msg, "%s %s HTTP/1.0\r\n", method, url); + snprintf(msg, sizeof(msg)-1, "%s %s HTTP/1.0\r\n", method, url); if (host) { url[0] = '\0'; - sprintf(buf, "Host: %s\r\n", host); + snprintf(buf, sizeof(buf)-1, "Host: %s\r\n", host); strcat(msg, buf); url[0] = '/'; } strcat(msg, "Accept: */*\r\n"); if (opt_ims && (lrand48() & 0x03) == 0) { w = time(NULL) - (lrand48() & 0x3FFFF); - sprintf(buf, "If-Modified-Since: %s\r\n", mkrfc850(&w)); + snprintf(buf, sizeof(buf)-1, "If-Modified-Since: %s\r\n", mkrfc850(&w)); strcat(msg, buf); } if (file && strcmp(file, "-") != 0) { @@ -369,7 +369,7 @@ request(char *urlin) { exit(1); } fstat(f, &st); - sprintf(buf, "Content-Length: %d\r\n", (int) st.st_size); + snprintf(buf, sizeof(buf)-1, "Content-Length: %d\r\n", (int) st.st_size); strcat(msg, buf); } if (opt_range && (lrand48() & 0x03) == 0) { @@ -382,13 +382,13 @@ request(char *urlin) { strcat(msg, ","); switch (lrand48() & 0x03) { case 0: - sprintf(buf, "-%d", len); + snprintf(buf, sizeof(buf)-1, "-%d", len); break; case 1: - sprintf(buf, "%d-", offset); + snprintf(buf, sizeof(buf)-1, "%d-", offset); break; default: - sprintf(buf, "%d-%d", offset, offset + len); + snprintf(buf, sizeof(buf)-1, "%d-%d", offset, offset + len); break; } strcat(msg, buf); @@ -480,10 +480,10 @@ char *argv[]; struct timeval to; setbuf(stdout, NULL); setbuf(stderr, NULL); - progname = strdup(argv[0]); + progname = xstrdup(argv[0]); gettimeofday(&now, NULL); start = last = now; - custom_header = strdup(""); + custom_header = xstrdup(""); while ((c = getopt(argc, argv, "ap:h:H:n:icrl:L:t:")) != -1) { switch (c) { case 'a': @@ -493,7 +493,7 @@ char *argv[]; proxy_port = atoi(optarg); break; case 'h': - proxy_addr = strdup(optarg); + proxy_addr = xstrdup(optarg); break; case 'n': max_connections = atoi(optarg); diff --git a/tools/purge/conffile.cc b/tools/purge/conffile.cc index 8d3fb62bd1..69da160da0 100644 --- a/tools/purge/conffile.cc +++ b/tools/purge/conffile.cc @@ -139,7 +139,7 @@ readConfigFile( CacheDirVector& cachedir, const char* fn, FILE* debug ) (int)subs[offset].rm_so, (int)subs[offset].rm_eo, line+subs[offset].rm_so ); - cd.base = strdup( line+subs[offset].rm_so ); + cd.base = xstrdup( line+subs[offset].rm_so ); ++offset; // extract size information