Просмотр исходного кода

* Ported cygwin/solaris fixes

svn: 2600
Bryan Drewery 20 лет назад
Родитель
Сommit
2c71159051
3 измененных файлов с 12 добавлено и 4 удалено
  1. 4 0
      src/compat/inet_ntop.c
  2. 7 3
      src/main.c
  3. 1 1
      src/mod/server.mod/server.c

+ 4 - 0
src/compat/inet_ntop.c

@@ -37,7 +37,9 @@
  */
 
 static const char *egg_inet_ntop4 (const u_char *src, char *dst, socklen_t size);
+#ifdef USE_IPV6
 static const char *egg_inet_ntop6 (const u_char *src, char *dst, socklen_t size);
+#endif /* USE_IPV6 */
 
 /* char *
  * inet_ntop(af, src, dst, size)
@@ -86,6 +88,7 @@ egg_inet_ntop4(const u_char *src, char *dst, socklen_t size)
 	return strcpy(dst, tmp);
 }
 
+#ifdef USE_IPV6
 /* const char *
  * inet_ntop6(src, dst, size)
  *	convert IPv6 binary address into presentation (printable) format
@@ -177,4 +180,5 @@ egg_inet_ntop6(const u_char *src, char *dst, socklen_t size)
 	}
 	return strcpy(dst, tmp);
 }
+#endif /* USE_IPV6 */
 #endif /* !HAVE_INET_NTOP */

+ 7 - 3
src/main.c

@@ -106,7 +106,7 @@ char *socksfile = NULL;
 
 static char *getfullbinname(const char *argv_zero)
 {
-  char *bin = strdup(argv_zero);
+  char *bin = strdup(argv_zero), *p = NULL, *p2 = NULL;
   char cwd[PATH_MAX] = "";
 
   if (bin[0] == '/')
@@ -122,7 +122,8 @@ static char *getfullbinname(const char *argv_zero)
   if (cwd[strlen(cwd) - 1] == '/')
     cwd[strlen(cwd) - 1] = 0;
 
-  char *p = bin, *p2 = strchr(p, '/');
+  p = bin;
+  p2 = strchr(p, '/');
 
   while (p) {
     if (p2)
@@ -866,7 +867,10 @@ printf("out: %s\n", out);
 
   debug0("main: entering loop");
 
-  int socket_cleanup = 0, status = 0, xx, i = 0, idx = 0;
+  int socket_cleanup = 0, xx, i = 0, idx = 0;
+#if !defined(CYGWIN_HACKS) && !defined(__sun__)
+  int status = 0;
+#endif /* !CYGWIN_HACKS */
   char buf[SGRAB + 10] = "";
 
   while (1) {

+ 1 - 1
src/mod/server.mod/server.c

@@ -807,7 +807,7 @@ static int sanitycheck_dcc(char *nick, char *from, char *ipaddy, char *port)
            nick, from, prt);
     return 0;
   }
-  sprintf(badaddress, "%u.%u.%u.%u", (ip >> 24) & 0xff, (ip >> 16) & 0xff,
+  simple_snprintf(badaddress, sizeof(badaddress), "%u.%u.%u.%u", (ip >> 24) & 0xff, (ip >> 16) & 0xff,
           (ip >> 8) & 0xff, ip & 0xff);
   if (ip < (1 << 24)) {
     putlog(LOG_MISC, "*", "ALERT: (%s!%s) specified an impossible IP of %s!",