This resolves a number more shadowed variables by renaming.
There should be no logic changes in this patch.
struct snmp_internal_session {
int sd; /* socket descriptor for this connection */
- ipaddr addr; /* address of connected peer */
+ struct sockaddr_in addr; /* address of connected peer */
struct request_list *requests; /* Info about outstanding requests */
};
extern "C" {
#endif
- typedef struct sockaddr_in ipaddr;
-
/* An SNMP PDU */
struct snmp_pdu {
int command; /* Type of this PDU */
- ipaddr address; /* Address of peer */
+ struct sockaddr_in address; /* Address of peer */
int reqid; /* Integer32: Request id */
int errstat; /* INTEGER: Error status */
/* Trap information */
oid *enterprise; /* System OID */
int enterprise_length;
- ipaddr agent_addr; /* address of object generating trap */
+ struct sockaddr_in agent_addr; /* address of object generating trap */
int trap_type; /* generic trap type */
int specific_type; /* specific type */
u_int time; /* Uptime */
}
void
-StatHist::count(double val)
+StatHist::count(double v)
{
if (bins==NULL) //do not count before initialization or after destruction
return;
- const unsigned int bin = findBin(val);
+ const unsigned int bin = findBin(v);
++bins[bin];
}
/* mark this user as having verification in progress */
user()->credentials(Auth::Pending);
char buf[HELPER_INPUT_BUFFER];
- static char username[HELPER_INPUT_BUFFER];
+ static char usern[HELPER_INPUT_BUFFER];
static char pass[HELPER_INPUT_BUFFER];
if (static_cast<Auth::Basic::Config*>(user()->config)->utf8) {
- latin1_to_utf8(username, sizeof(username), user()->username());
+ latin1_to_utf8(usern, sizeof(usern), user()->username());
latin1_to_utf8(pass, sizeof(pass), basic_auth->passwd);
- xstrncpy(username, rfc1738_escape(username), sizeof(username));
+ xstrncpy(usern, rfc1738_escape(usern), sizeof(usern));
xstrncpy(pass, rfc1738_escape(pass), sizeof(pass));
} else {
- xstrncpy(username, rfc1738_escape(user()->username()), sizeof(username));
+ xstrncpy(usern, rfc1738_escape(user()->username()), sizeof(usern));
xstrncpy(pass, rfc1738_escape(basic_auth->passwd), sizeof(pass));
}
- int sz = snprintf(buf, sizeof(buf), "%s %s\n", username, pass);
+ int sz = snprintf(buf, sizeof(buf), "%s %s\n", usern, pass);
if (sz<=0) {
debugs(9, DBG_CRITICAL, "ERROR: Basic Authentication Failure. Can not build helper validation request.");
handler(data);
}
/* find type */
- http_digest_attr_type type = (http_digest_attr_type)httpHeaderIdByName(item, nlen, DigestFieldsInfo, DIGEST_ENUM_END);
+ http_digest_attr_type t = (http_digest_attr_type)httpHeaderIdByName(item, nlen, DigestFieldsInfo, DIGEST_ENUM_END);
- switch (type) {
+ switch (t) {
case DIGEST_USERNAME:
safe_free(username);
username = xstrndup(value.rawBuf(), value.size() + 1);
#endif
if (calloutContext->error) {
- const char *uri = urlCanonical(request);
- StoreEntry *e= storeCreateEntry(uri, uri, request->flags, request->method);
+ const char *url = urlCanonical(request);
+ StoreEntry *e= storeCreateEntry(url, url, request->flags, request->method);
#if USE_SSL
if (sslBumpNeeded()) {
// set final error but delay sending until we bump
}
static void
-idnsInitVC(int ns)
+idnsInitVC(int nsv)
{
nsvc *vc = cbdataAlloc(nsvc);
- assert(ns < nns);
+ assert(nsv < nns);
assert(vc->conn == NULL); // MUST be NULL from the construction process!
- nameservers[ns].vc = vc;
- vc->ns = ns;
+ nameservers[nsv].vc = vc;
+ vc->ns = nsv;
vc->queue = new MemBuf;
vc->msg = new MemBuf;
vc->busy = 1;
else
conn->local = Config.Addrs.udp_incoming;
- conn->remote = nameservers[ns].S;
+ conn->remote = nameservers[nsv].S;
if (conn->remote.IsIPv4()) {
conn->local.SetIPv4();
}
static void
-idnsSendQueryVC(idns_query * q, int ns)
+idnsSendQueryVC(idns_query * q, int nsn)
{
- assert(ns < nns);
- if (nameservers[ns].vc == NULL)
- idnsInitVC(ns);
+ assert(nsn < nns);
+ if (nameservers[nsn].vc == NULL)
+ idnsInitVC(nsn);
- nsvc *vc = nameservers[ns].vc;
+ nsvc *vc = nameservers[nsn].vc;
if (!vc) {
char buf[MAX_IPSTRLEN];
- debugs(78, DBG_IMPORTANT, "idnsSendQuery: Failed to initiate TCP connection to nameserver " << nameservers[ns].S.NtoA(buf,MAX_IPSTRLEN) << "!");
+ debugs(78, DBG_IMPORTANT, "idnsSendQuery: Failed to initiate TCP connection to nameserver " << nameservers[nsn].S.NtoA(buf,MAX_IPSTRLEN) << "!");
return;
}
assert(q->lru.prev == NULL);
int x = -1, y = -1;
- int ns;
+ int nsn;
do {
- ns = q->nsends % nns;
+ nsn = q->nsends % nns;
if (q->need_vc) {
- idnsSendQueryVC(q, ns);
+ idnsSendQueryVC(q, nsn);
x = y = 0;
} else {
- if (DnsSocketB >= 0 && nameservers[ns].S.IsIPv6())
- y = comm_udp_sendto(DnsSocketB, nameservers[ns].S, q->buf, q->sz);
+ if (DnsSocketB >= 0 && nameservers[nsn].S.IsIPv6())
+ y = comm_udp_sendto(DnsSocketB, nameservers[nsn].S, q->buf, q->sz);
else if (DnsSocketA >= 0)
- x = comm_udp_sendto(DnsSocketA, nameservers[ns].S, q->buf, q->sz);
+ x = comm_udp_sendto(DnsSocketA, nameservers[nsn].S, q->buf, q->sz);
}
++ q->nsends;
q->sent_t = current_time;
- if (y < 0 && nameservers[ns].S.IsIPv6())
+ if (y < 0 && nameservers[nsn].S.IsIPv6())
debugs(50, DBG_IMPORTANT, "idnsSendQuery: FD " << DnsSocketB << ": sendto: " << xstrerror());
- if (x < 0 && nameservers[ns].S.IsIPv4())
+ if (x < 0 && nameservers[nsn].S.IsIPv4())
debugs(50, DBG_IMPORTANT, "idnsSendQuery: FD " << DnsSocketA << ": sendto: " << xstrerror());
} while ( (x<0 && y<0) && q->nsends % nns != 0);
fd_bytes(DnsSocketA, x, FD_WRITE);
}
- ++ nameservers[ns].nqueries;
+ ++ nameservers[nsn].nqueries;
q->queue_t = current_time;
dlinkAdd(q, &q->lru, &lru_list);
q->pending = 1;
if (q->master)
q = q->master;
- idns_query *q2;
// If any of our subqueries are still pending then wait for them to complete before continuing
- for ( q2 = q; q2; q2 = q2->slave) {
+ for (idns_query *q2 = q; q2; q2 = q2->slave) {
if (q2->pending) {
return;
}
int n = q->ancount;
error = q->error;
- while ( (q2 = q->slave) ) {
+ while ( idns_query *q2 = q->slave ) {
debugs(78, 6, HERE << "Merging DNS results " << q->name << " A has " << n << " RR, AAAA has " << q2->ancount << " RR");
q->slave = q2->slave;
if ( !q2->error ) {
int len;
int max = INCOMING_DNS_MAX;
static char rbuf[SQUID_UDP_SO_RCVBUF];
- int ns;
Ip::Address from;
debugs(78, 3, "idnsRead: starting with FD " << fd);
debugs(78, 3, "idnsRead: FD " << fd << ": received " << len << " bytes from " << from);
/* BUG: see above. Its here that it becomes apparent that the content of bugbypass is gone. */
- ns = idnsFromKnownNameserver(from);
+ int nsn = idnsFromKnownNameserver(from);
- if (ns >= 0) {
- ++ nameservers[ns].nreplies;
+ if (nsn >= 0) {
+ ++ nameservers[nsn].nreplies;
}
// Before unknown_nameservers check to avoid flooding cache.log on attacks,
if (!lru_list.head)
continue; // Don't process replies if there is no pending query.
- if (ns < 0 && Config.onoff.ignore_unknown_nameservers) {
+ if (nsn < 0 && Config.onoff.ignore_unknown_nameservers) {
static time_t last_warning = 0;
if (squid_curtime - last_warning > 60) {
continue;
}
- idnsGrokReply(rbuf, len, ns);
+ idnsGrokReply(rbuf, len, nsn);
}
}
/// parse maximum db disk size
void
-Rock::SwapDir::parseSize(const bool reconfiguring)
+Rock::SwapDir::parseSize(const bool reconfig)
{
const int i = GetInteger();
if (i < 0)
fatal("negative Rock cache_dir size value");
const uint64_t new_max_size =
static_cast<uint64_t>(i) << 20; // MBytes to Bytes
- if (!reconfiguring)
+ if (!reconfig)
max_size = new_max_size;
else if (new_max_size != max_size) {
debugs(3, DBG_IMPORTANT, "WARNING: cache_dir '" << path << "' size "
/// parses time-specific options; mimics ::SwapDir::optionObjectSizeParse()
bool
-Rock::SwapDir::parseTimeOption(char const *option, const char *value, int reconfiguring)
+Rock::SwapDir::parseTimeOption(char const *option, const char *value, int reconfig)
{
// TODO: ::SwapDir or, better, Config should provide time-parsing routines,
// including time unit handling. Same for size.
const time_msec_t newTime = static_cast<time_msec_t>(parsedValue);
- if (!reconfiguring)
+ if (!reconfig)
*storedTime = newTime;
else if (*storedTime != newTime) {
debugs(3, DBG_IMPORTANT, "WARNING: cache_dir " << path << ' ' << option
sio->offset_ += rlen;
assert(sio->diskOffset + sio->offset_ <= diskOffsetLimit()); // post-factum
- StoreIOState::STRCB *callback = sio->read.callback;
- assert(callback);
+ StoreIOState::STRCB *callb = sio->read.callback;
+ assert(callb);
sio->read.callback = NULL;
void *cbdata;
if (cbdataReferenceValidDone(sio->read.callback_data, &cbdata))
- callback(cbdata, r->buf, rlen, sio.getRaw());
+ callb(cbdata, r->buf, rlen, sio.getRaw());
}
void
debugs(54, 6, HERE << "opening listen FD at " << p.addr << " for kid" <<
request.requestorId);
- Comm::ConnectionPointer conn = new Comm::Connection;
- conn->local = p.addr; // comm_open_listener may modify it
- conn->flags = p.flags;
+ Comm::ConnectionPointer newConn = new Comm::Connection;
+ newConn->local = p.addr; // comm_open_listener may modify it
+ newConn->flags = p.flags;
enter_suid();
- comm_open_listener(p.sock_type, p.proto, conn, FdNote(p.fdNote));
- errNo = Comm::IsConnOpen(conn) ? 0 : errno;
+ comm_open_listener(p.sock_type, p.proto, newConn, FdNote(p.fdNote));
+ errNo = Comm::IsConnOpen(newConn) ? 0 : errno;
leave_suid();
- debugs(54, 6, HERE << "tried listening on " << conn << " for kid" <<
+ debugs(54, 6, HERE << "tried listening on " << newConn << " for kid" <<
request.requestorId);
// cache positive results
- if (Comm::IsConnOpen(conn))
- listeners[request.params] = conn;
+ if (Comm::IsConnOpen(newConn))
+ listeners[request.params] = newConn;
- return conn;
+ return newConn;
}
void Ipc::Coordinator::broadcastSignal(int sig) const
}
/// called when kid terminates, sets exiting status
-void Kid::stop(status_type exitStatus)
+void Kid::stop(status_type theExitStatus)
{
assert(running());
assert(startTime != 0);
else
badFailures = 0; // the failures are not "frequent" [any more]
- status = exitStatus;
+ status = theExitStatus;
}
/// returns true if tracking of kid is stopped
}
void
-Ipc::TypedMsgHdr::getFixed(void *raw, size_t size) const
+Ipc::TypedMsgHdr::getFixed(void *rawBuf, size_t rawSize) const
{
// no need to load size because it is constant
- getRaw(raw, size);
+ getRaw(rawBuf, rawSize);
}
void
-Ipc::TypedMsgHdr::putFixed(const void *raw, size_t size)
+Ipc::TypedMsgHdr::putFixed(const void *rawBuf, size_t rawSize)
{
// no need to store size because it is constant
- putRaw(raw, size);
+ putRaw(rawBuf, rawSize);
}
/// low-level loading of exactly size bytes of raw data
void
-Ipc::TypedMsgHdr::getRaw(void *raw, size_t size) const
+Ipc::TypedMsgHdr::getRaw(void *rawBuf, size_t rawSize) const
{
- if (size > 0) {
- Must(size <= data.size - offset);
- memcpy(raw, data.raw + offset, size);
- offset += size;
+ if (rawSize > 0) {
+ Must(rawSize <= data.size - offset);
+ memcpy(rawBuf, data.raw + offset, rawSize);
+ offset += rawSize;
}
}
/// low-level storage of exactly size bytes of raw data
void
-Ipc::TypedMsgHdr::putRaw(const void *raw, size_t size)
+Ipc::TypedMsgHdr::putRaw(const void *rawBuf, size_t rawSize)
{
- if (size > 0) {
- Must(size <= sizeof(data.raw) - data.size);
- memcpy(data.raw + data.size, raw, size);
- data.size += size;
+ if (rawSize > 0) {
+ Must(rawSize <= sizeof(data.raw) - data.size);
+ memcpy(data.raw + data.size, rawBuf, rawSize);
+ data.size += rawSize;
}
}
return new IndexAction(cmd);
}
-Mgr::IndexAction::IndexAction(const Command::Pointer &cmd): Action(cmd)
+Mgr::IndexAction::IndexAction(const Command::Pointer &aCmd): Action(aCmd)
{
debugs(16, 5, HERE);
}
return new MenuAction(cmd);
}
-Mgr::MenuAction::MenuAction(const Command::Pointer &cmd): Action(cmd)
+Mgr::MenuAction::MenuAction(const Command::Pointer &aCmd): Action(aCmd)
{
debugs(16, 5, HERE);
}
return new ShutdownAction(cmd);
}
-Mgr::ShutdownAction::ShutdownAction(const Command::Pointer &cmd): Action(cmd)
+Mgr::ShutdownAction::ShutdownAction(const Command::Pointer &aCmd): Action(aCmd)
{
debugs(16, 5, HERE);
}
return new ReconfigureAction(cmd);
}
-Mgr::ReconfigureAction::ReconfigureAction(const Command::Pointer &cmd):
- Action(cmd)
+Mgr::ReconfigureAction::ReconfigureAction(const Command::Pointer &aCmd):
+ Action(aCmd)
{
debugs(16, 5, HERE);
}
return new RotateAction(cmd);
}
-Mgr::RotateAction::RotateAction(const Command::Pointer &cmd): Action(cmd)
+Mgr::RotateAction::RotateAction(const Command::Pointer &aCmd): Action(aCmd)
{
debugs(16, 5, HERE);
}
return new OfflineToggleAction(cmd);
}
-Mgr::OfflineToggleAction::OfflineToggleAction(const Command::Pointer &cmd):
- Action(cmd)
+Mgr::OfflineToggleAction::OfflineToggleAction(const Command::Pointer &aCmd):
+ Action(aCmd)
{
debugs(16, 5, HERE);
}
return new CountersAction(cmd);
}
-Mgr::CountersAction::CountersAction(const CommandPointer &cmd):
- Action(cmd), data()
+Mgr::CountersAction::CountersAction(const CommandPointer &aCmd):
+ Action(aCmd), data()
{
debugs(16, 5, HERE);
}
return new InfoAction(cmd);
}
-Mgr::InfoAction::InfoAction(const CommandPointer &cmd):
- Action(cmd), data()
+Mgr::InfoAction::InfoAction(const CommandPointer &aCmd):
+ Action(aCmd), data()
{
debugs(16, 5, HERE);
}
return new IntervalAction(cmd, 60, 0);
}
-Mgr::IntervalAction::IntervalAction(const CommandPointer &cmd, int aMinutes, int aHours):
- Action(cmd), minutes(aMinutes), hours(aHours), data()
+Mgr::IntervalAction::IntervalAction(const CommandPointer &aCmd, int aMinutes, int aHours):
+ Action(aCmd), minutes(aMinutes), hours(aHours), data()
{
debugs(16, 5, HERE);
}
return new IoAction(cmd);
}
-Mgr::IoAction::IoAction(const CommandPointer &cmd):
- Action(cmd), data()
+Mgr::IoAction::IoAction(const CommandPointer &aCmd):
+ Action(aCmd), data()
{
debugs(16, 5, HERE);
}
return new ServiceTimesAction(cmd);
}
-Mgr::ServiceTimesAction::ServiceTimesAction(const CommandPointer &cmd):
- Action(cmd), data()
+Mgr::ServiceTimesAction::ServiceTimesAction(const CommandPointer &aCmd):
+ Action(aCmd), data()
{
debugs(16, 5, HERE);
}
return new StoreIoAction(cmd);
}
-Mgr::StoreIoAction::StoreIoAction(const CommandPointer &cmd):
- Action(cmd), data()
+Mgr::StoreIoAction::StoreIoAction(const CommandPointer &aCmd):
+ Action(aCmd), data()
{
debugs(16, 5, HERE);
}
if (Ip::EnableIpv6&IPV6_SPECIAL_SPLITSTACK && snmpOutgoingConn->local.IsAnyAddr()) {
snmpOutgoingConn->local.SetIPv4();
}
- AsyncCall::Pointer call = asyncCall(49, 2, "snmpOutgoingConnectionOpened",
- Comm::UdpOpenDialer(&snmpPortOpened));
- Ipc::StartListening(SOCK_DGRAM, IPPROTO_UDP, snmpOutgoingConn, Ipc::fdnOutSnmpSocket, call);
+ AsyncCall::Pointer c = asyncCall(49, 2, "snmpOutgoingConnectionOpened",
+ Comm::UdpOpenDialer(&snmpPortOpened));
+ Ipc::StartListening(SOCK_DGRAM, IPPROTO_UDP, snmpOutgoingConn, Ipc::fdnOutSnmpSocket, c);
} else {
snmpOutgoingConn = snmpIncomingConn;
debugs(1, DBG_IMPORTANT, "Sending SNMP messages from " << snmpOutgoingConn->local);
*NextLen = CurrentLen;
*Next = (*mibTreeEntry->instancefunction) (Current, NextLen, mibTreeEntry, &Fn);
if (*Next) {
- MemBuf tmp;
debugs(49, 6, "snmpTreeNext: Next : " << snmpDebugOid(*Next, *NextLen, tmp));
return (Fn);
}
}
if (*Next) {
- MemBuf tmp;
debugs(49, 6, "snmpTreeNext: Next : " << snmpDebugOid(*Next, *NextLen, tmp));
return (Fn);
} else
#include "tests/STUB.h"
HttpRequest::HttpRequest() : HttpMsg(hoRequest) STUB
- HttpRequest::HttpRequest(const HttpRequestMethod& method, AnyP::ProtocolType protocol, const char *aUrlpath) : HttpMsg(hoRequest) STUB
+ HttpRequest::HttpRequest(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath) : HttpMsg(hoRequest) STUB
HttpRequest::~HttpRequest() STUB
void HttpRequest::packFirstLineInto(Packer * p, bool full_uri) const STUB
bool HttpRequest::sanityCheckStartLine(MemBuf *buf, const size_t hdr_len, http_status *error) STUB_RETVAL(false)
/* should be in stub_CommRead */
#include "CommRead.h"
-CommRead::CommRead(const Comm::ConnectionPointer &, char *buf, int len, AsyncCall::Pointer &callback) STUB
+CommRead::CommRead(const Comm::ConnectionPointer &, char *, int, AsyncCall::Pointer &) STUB
CommRead::CommRead() STUB
DeferredReadManager::~DeferredReadManager() STUB
DeferredRead::DeferredRead(DeferrableRead *, void *, CommRead const &) STUB
bool Comm::IsConnOpen(const Comm::ConnectionPointer &) STUB_RETVAL(false)
#include "comm/IoCallback.h"
- void Comm::IoCallback::setCallback(iocb_type type, AsyncCall::Pointer &cb, char *buf, FREE *func, int sz) STUB
+ void Comm::IoCallback::setCallback(iocb_type, AsyncCall::Pointer &, char *, FREE *, int) STUB
void Comm::IoCallback::selectOrQueueWrite() STUB
void Comm::IoCallback::cancel(const char *reason) STUB
void Comm::IoCallback::finish(comm_err_t code, int xerrn) STUB
bool StoreEntry::checkDeferRead(int fd) const STUB_RETVAL(false)
const char *StoreEntry::getMD5Text() const STUB_RETVAL(NULL)
StoreEntry::StoreEntry() STUB
-StoreEntry::StoreEntry(const char *url, const char *log_url) STUB
+StoreEntry::StoreEntry(const char *, const char *) STUB
StoreEntry::~StoreEntry() STUB
HttpReply const *StoreEntry::getReply() const STUB_RETVAL(NULL)
void StoreEntry::write(StoreIOBuffer) STUB
int calls;
int lasttimeout;
int return_timeout;
- RecordingEngine(int return_timeout=0): calls(0), lasttimeout(0),
- return_timeout(return_timeout) {}
+ RecordingEngine(int aTimeout=0): calls(0), lasttimeout(0), return_timeout(aTimeout) {}
virtual int checkEvents(int timeout) {
++calls;
{
public:
bool operator==(const InspectingStatHist &);
- bins_type counter(double val) {
- return bins[findBin(val)];
+ bins_type counter(double v) {
+ return bins[findBin(v)];
}
};
SplayCheck::BeginWalk();
safeTop->walk(SplayCheck::WalkNodeRef, NULL);
}
+
/* check the check routine */
- SplayCheck::BeginWalk();
- intnode I;
- I.i = 1;
- /* check we don't segfault on NULL splay calls */
- SplayCheck::WalkNodeRef(I, NULL);
- I.i = 0;
- SplayCheck::ExpectedFail = true;
- SplayCheck::WalkNodeRef(I, NULL);
+ {
+ SplayCheck::BeginWalk();
+ intnode I;
+ I.i = 1;
+ /* check we don't segfault on NULL splay calls */
+ SplayCheck::WalkNodeRef(I, NULL);
+ I.i = 0;
+ SplayCheck::ExpectedFail = true;
+ SplayCheck::WalkNodeRef(I, NULL);
+ }
{
/* check for begin() */
return false;
}
- int size = strlen(buffer);
- if ( write( sockfd, buffer, size ) != size ) {
+ int content_size = strlen(buffer);
+ if ( write( sockfd, buffer, content_size ) != content_size ) {
// error while talking to squid
fprintf( stderr, "unable to talk to server: %s\n", strerror(errno) );
close(sockfd);
}
int
-checkForPortOnly( const char* optarg )
+checkForPortOnly( const char* arg )
// purpose: see if somebody just put in a port instead of a hostname
// paramtr: optarg (IN): argument from commandline
// returns: 0..65535 is the valid port number in network byte order,
// -1 if not a port
{
// if there is a period in there, it must be a valid hostname
- if ( strchr( optarg, '.' ) != 0 ) return -1;
+ if ( strchr( arg, '.' ) != 0 ) return -1;
// if it is just a number between 0 and 65535, it must be a port
char* errstr = 0;
- unsigned long result = strtoul( optarg, &errstr, 0 );
- if ( result < 65536 && errstr != optarg ) return htons(result);
+ unsigned long result = strtoul( arg, &errstr, 0 );
+ if ( result < 65536 && errstr != arg ) return htons(result);
#if 0
// one last try, test for a symbolical service name
- struct servent* service = getservbyname( optarg, "tcp" );
+ struct servent* service = getservbyname( arg, "tcp" );
return service ? service->s_port : -1;
#else
return -1;
void
parseCommandline( int argc, char* argv[], REList*& head,
- char*& conffile, char*& copydir,
- struct in_addr& serverHost, unsigned short& serverPort )
+ char*& conffile, char*& copyDirPath,
+ struct in_addr& serverHostIp, unsigned short& serverHostPort )
// paramtr: argc: see ::main().
// argv: see ::main().
// returns: Does terminate the program on errors!
break;
case 'C':
if ( optarg && *optarg ) {
- if ( copydir ) xfree( (void*) copydir );
- copydir = xstrdup(optarg);
- assert(copydir);
+ if ( copyDirPath ) xfree( (void*) copyDirPath );
+ copyDirPath = xstrdup(optarg);
+ assert(copyDirPath);
}
break;
case 'c':
port = checkForPortOnly( optarg );
if ( port == -1 ) {
// assume that main() did set the default port
- if ( convertHostname(optarg,serverHost) == -1 ) {
+ if ( convertHostname(optarg,serverHostIp) == -1 ) {
fprintf( stderr, "unable to resolve host %s!\n", optarg );
exit(1);
}
} else {
// assume that main() did set the default host
- serverPort = port;
+ serverHostPort = port;
}
} else {
// colon used, port is extra
*colon = 0;
++colon;
- if ( convertHostname(optarg,serverHost) == -1 ) {
+ if ( convertHostname(optarg,serverHostIp) == -1 ) {
fprintf( stderr, "unable to resolve host %s!\n", optarg );
exit(1);
}
- if ( convertPortname(colon,serverPort) == -1 ) {
+ if ( convertPortname(colon,serverHostPort) == -1 ) {
fprintf( stderr, "unable to resolve port %s!\n", colon );
exit(1);
}
assert( head != 0 );
// make sure that the copy out directory is there and accessible
- if ( copydir && *copydir )
- if ( assert_copydir( copydir ) != 0 ) exit(1);
+ if ( copyDirPath && *copyDirPath )
+ if ( assert_copydir( copyDirPath ) != 0 ) exit(1);
// show results
if ( showme ) {
puts( ::verbose ? " + extra verbosity" : "" );
printf( "# Copy-out directory: %s ",
- copydir ? copydir : "copy-out mode disabled" );
- if ( copydir )
+ copyDirPath ? copyDirPath : "copy-out mode disabled" );
+ if ( copyDirPath )
printf( "(%s HTTP header)\n", ::envelope ? "prepend" : "no" );
else
puts("");
printf( "# Squid config file : %s\n", conffile );
printf( "# Cacheserveraddress: %s:%u\n",
- inet_ntoa( serverHost ), ntohs( serverPort ) );
+ inet_ntoa( serverHostIp ), ntohs( serverHostPort ) );
printf( "# purge mode : 0x%02x\n", ::purgeMode );
printf( "# Regular expression: " );
}
if ( reuse ) {
- int reuse = 1;
+ int opt = 1;
if ( setsockopt( sockfd, SOL_SOCKET, SO_REUSEADDR,
- (char*) &reuse, sizeof(int) ) == -1) {
+ (char*) &opt, sizeof(int) ) == -1) {
perror( "setsockopt( SO_REUSEADDR )" );
close( sockfd );
return -1;