From 406ba755d644fc90222ff556fa1f58adcb365e7e Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 12 Apr 2003 15:56:25 +0000 Subject: [PATCH] - code cleanup / misc minor bugfixes (MyMalloc, oper msgs) --- Changes | 1 + src/cloak.c | 2 +- src/hash.c | 2 +- src/list.c | 2 +- src/modules.c | 4 ++-- src/res.c | 2 +- src/s_auth.c | 2 +- src/s_bsd.c | 6 +++--- src/s_conf.c | 6 +++--- src/s_serv.c | 4 ++-- src/s_svs.c | 2 +- 11 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Changes b/Changes index 63ba24302..79abb5c71 100644 --- a/Changes +++ b/Changes @@ -2035,3 +2035,4 @@ seen. gmtime warning still there - Added allow::options::ssl and allow::options::nopasscont, requested by iguy and Scytale. - Removed usermode +b from docs (been gone for a long time) (#0000798) reported by Rocko - Fixed an SQLINE bug +- code cleanup / misc minor bugfixes (MyMalloc, oper msgs) diff --git a/src/cloak.c b/src/cloak.c index 13bdc132c..0e3644a8f 100644 --- a/src/cloak.c +++ b/src/cloak.c @@ -172,7 +172,7 @@ char *hidehost(char *rhost) int i; char *p, *q; - host = malloc(strlen(rhost)+1); + host = MyMalloc(strlen(rhost)+1); q = host; for (p = rhost; *p; p++, q++) { *q = tolower(*p); diff --git a/src/hash.c b/src/hash.c index 2864da68b..a61595f27 100644 --- a/src/hash.c +++ b/src/hash.c @@ -779,7 +779,7 @@ void add_throttling_bucket(struct IN_ADDR *in) int hash; struct ThrottlingBucket *n; - n = malloc(sizeof(struct ThrottlingBucket)); + n = MyMalloc(sizeof(struct ThrottlingBucket)); n->next = n->prev = NULL; bcopy(in, &n->in, sizeof(struct IN_ADDR)); n->since = TStime(); diff --git a/src/list.c b/src/list.c index 780d09514..30b747a88 100644 --- a/src/list.c +++ b/src/list.c @@ -245,7 +245,7 @@ void free_user(anUser *user, aClient *cptr) */ if (user->joined || user->refcnt < 0 || user->invited || user->channel) - sendto_ops("* %#x user (%s!%s@%s) %#x %#x %#x %d %d *", + sendto_realops("* %#x user (%s!%s@%s) %#x %#x %#x %d %d *", cptr, cptr ? cptr->name : "", user->username, user->realhost, user, user->invited, user->channel, user->joined, diff --git a/src/modules.c b/src/modules.c index 6c25f3d01..e11509a1b 100644 --- a/src/modules.c +++ b/src/modules.c @@ -62,7 +62,7 @@ Module *Module_make(ModuleHeader *header, ); #ifdef UNDERSCORE void *obsd_dlsym(void *handle, char *symbol) { - char *obsdsymbol = (char*)malloc(strlen(symbol) + 2); + char *obsdsymbol = (char*)MyMalloc(strlen(symbol) + 2); void *symaddr = NULL; if (obsdsymbol) { @@ -127,7 +127,7 @@ char *Module_Create(char *path_) if(!strchr(path, '/')) { - path = malloc(strlen(path) + 3); + path = MyMalloc(strlen(path) + 3); strcpy(path, "./"); strcat(path, path_); } diff --git a/src/res.c b/src/res.c index cc7cc2712..84c583044 100644 --- a/src/res.c +++ b/src/res.c @@ -1054,7 +1054,7 @@ struct hostent *get_res(char *lp,long id) a = proc_answer(rptr, hptr, buf, buf + rc); if (a == -1) { - sendto_ops("Bad hostname returned from %s for %s", + sendto_snomask(SNO_JUNK, "Bad hostname returned from %s for %s", inet_ntoa(sin.sin_addr), Inet_ia2p((struct IN_ADDR *)&rptr->he.h_addr)); Debug((DEBUG_DNS, "Bad hostname returned from %s for %s", diff --git a/src/s_auth.c b/src/s_auth.c index 49c41e9e1..745f48a76 100644 --- a/src/s_auth.c +++ b/src/s_auth.c @@ -75,7 +75,7 @@ void start_auth(aClient *cptr) } if (++OpenFiles >= (MAXCONNECTIONS - 2)) { - sendto_ops("Can't allocate fd for auth on %s, too many connections.", get_client_name(cptr, TRUE)); + sendto_ops("Can't allocate fd, too many connections."); CLOSE_SOCK(cptr->authfd); --OpenFiles; cptr->authfd = -1; diff --git a/src/s_bsd.c b/src/s_bsd.c index 0f5528ebf..ad1c4c064 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -1045,7 +1045,7 @@ void set_sock_opts(int fd, aClient *cptr) for (*readbuf = '\0'; opt > 0; opt--, s += 3) (void)ircsprintf(s, "%2.2x:", *t++); *s = '\0'; - sendto_ops("Connection %s using IP opts: (%s)", + sendto_realops("Connection %s using IP opts: (%s)", get_client_name(cptr, TRUE), readbuf); } if (setsockopt(fd, IPPROTO_IP, IP_OPTIONS, (OPT_TYPE *)NULL, @@ -1820,7 +1820,7 @@ int read_message(time_t delay, fdlist *listp) if (++OpenFiles >= MAXCLIENTS) { ircstp->is_ref++; - sendto_ops("All connections in use. (%s)", + sendto_realops("All connections in use. (%s)", get_client_name(cptr, TRUE)); #ifndef INET6 (void)send(fd, @@ -2221,7 +2221,7 @@ int read_message(time_t delay, fdlist *listp) if (fd >= MAXCLIENTS) { ircstp->is_ref++; - sendto_ops("All connections in use. (%s)", + sendto_realops("All connections in use. (%s)", get_client_name(cptr, TRUE)); (void)send(fd, "ERROR :All connections in use\r\n", 32, 0); diff --git a/src/s_conf.c b/src/s_conf.c index 526f59796..aa41d51b8 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -4366,7 +4366,7 @@ int _test_badword(ConfigFile *conf, ConfigEntry *ce) { errorcode = regcomp(&expr, word->ce_vardata, REG_ICASE); else { - tmpbuf = malloc(strlen(word->ce_vardata) + + tmpbuf = MyMalloc(strlen(word->ce_vardata) + strlen(PATTERN) -1); ircsprintf(tmpbuf, PATTERN, word->ce_vardata); errorcode = regcomp(&expr, tmpbuf, REG_ICASE); @@ -4374,7 +4374,7 @@ int _test_badword(ConfigFile *conf, ConfigEntry *ce) { if (errorcode > 0) { errorbufsize = regerror(errorcode, &expr, NULL, 0)+1; - errorbuf = malloc(errorbufsize); + errorbuf = MyMalloc(errorbufsize); regerror(errorcode, &expr, errorbuf, errorbufsize); config_error("%s:%i: badword::%s contains an invalid regex: %s", word->ce_fileptr->cf_filename, @@ -5901,7 +5901,7 @@ int _test_alias(ConfigFile *conf, ConfigEntry *ce) { if (errorcode > 0) { errorbufsize = regerror(errorcode, &expr, NULL, 0)+1; - errorbuf = malloc(errorbufsize); + errorbuf = MyMalloc(errorbufsize); regerror(errorcode, &expr, errorbuf, errorbufsize); config_error("%s:%i: alias::format contains an invalid regex: %s", cep->ce_fileptr->cf_filename, diff --git a/src/s_serv.c b/src/s_serv.c index c973cb119..c85ba218b 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -724,7 +724,7 @@ errlink: "ERROR :Server %s already exists from %s", servername, (ocptr->from ? ocptr->from->name : "")); - sendto_ops + sendto_realops ("Link %s cancelled, server %s already exists from %s", get_client_name(acptr, TRUE), servername, (ocptr->from ? ocptr->from->name : "")); @@ -911,7 +911,7 @@ CMD_FUNC(m_server_remote) "ERROR :Server %s already exists from %s", servername, (ocptr->from ? ocptr->from->name : "")); - sendto_ops + sendto_realops ("Link %s cancelled, server %s already exists from %s", get_client_name(acptr, TRUE), servername, (ocptr->from ? ocptr->from->name : "")); diff --git a/src/s_svs.c b/src/s_svs.c index 99a62cc96..2f7a89a9a 100644 --- a/src/s_svs.c +++ b/src/s_svs.c @@ -279,7 +279,7 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) { int i = 0, j = 0, k = 1; char output[501]; char nums[4]; - char *current = malloc(strlen(parv[1])+1); + char *current = MyMalloc(strlen(parv[1])+1); char *xparv[3]; bzero(current, strlen(parv[1])+1); bzero(output, sizeof output);