]> jfr.im git - irc/quakenet/newserv.git/blobdiff - nterfacer/nterfacer.c
TRUSTS: require sqlite
[irc/quakenet/newserv.git] / nterfacer / nterfacer.c
index d6e49b4ba2dcf3fe4406484902fcea60a0b06761..5efe8d977d1fd93684efeee7eec122c358903c61 100644 (file)
@@ -189,7 +189,7 @@ int load_permits(void) {
       continue;
     }
 
-    item->ihost = (*(struct in_addr *)host->h_addr).s_addr;
+    item->ihost = (*(struct in_addr *)host->h_addr_list[0]).s_addr;
     for(j=0;j<loaded_lines;j++) {
       if(new_permits[j].ihost == item->ihost) {
         nterface_log(nrl, NL_WARNING, "Host with items %d and %d is identical, dropping item %d.", j + 1, i + 1, i + 1);
@@ -251,6 +251,7 @@ int setup_listening_socket(void) {
   
   if(bind(fd, (struct sockaddr *) &sin, sizeof(sin))) {
     nterface_log(nrl, NL_ERROR, "Unable to bind listen socket (%d).", errno);
+    close(fd);
     return -1;
   }
   
@@ -258,6 +259,7 @@ int setup_listening_socket(void) {
   
   if(ioctl(fd, FIONBIO, &opt)) {
     nterface_log(nrl, NL_ERROR, "Unable to set listen socket non-blocking.");
+    close(fd);
     return -1;
   }
   
@@ -359,6 +361,7 @@ void nterfacer_accept_event(struct esocket *socket) {
 
   if(ioctl(newfd, FIONBIO, &opt)) {
     nterface_log(nrl, NL_ERROR, "Unable to set accepted socket non-blocking.");
+    close(newfd);
     return;
   }
   
@@ -553,7 +556,7 @@ int nterfacer_new_rline(char *line, struct esocket *socket, int *number) {
     if(*p == ',')
       break;
 
-  if(!*p || !(p + 1))
+  if(!*p || !*(p + 1))
     return RE_BAD_LINE;
   
   *p = '\0';
@@ -602,7 +605,6 @@ int nterfacer_new_rline(char *line, struct esocket *socket, int *number) {
   if(argcount) {
     parsebuf = (char *)ntmalloc(strlen(pp) + 1);
     MemCheckR(parsebuf, RE_MEM_ERROR);
-    newp = parsebuf;
   
     for(newp=args[0]=parsebuf,pp++;*pp;pp++) {
       if((*pp == '\\') && *(pp + 1)) {