]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conn.c
New configuration option "OperServerMode".
[ngircd-alex.git] / src / ngircd / conn.c
index f0bf5f08353989dba066f76239efa003d9940ca6..ba874f8a71bd5f57b9b13595677494f88c6b9d80 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: conn.c,v 1.141 2004/12/22 17:37:41 alex Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.143 2005/01/19 23:33:54 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -529,7 +529,7 @@ va_dcl
 #else
        va_start( ap );
 #endif
-       if( vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) == COMMAND_LEN - 2 )
+       if( vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) >= COMMAND_LEN - 2 )
        {
                Log( LOG_CRIT, "Text too long to send (connection %d)!", Idx );
                Conn_Close( Idx, "Text too long to send!", NULL, FALSE );
@@ -1012,32 +1012,17 @@ New_Connection( INT Sock )
                        return;
                }
 
-               /* zunaechst realloc() versuchen; wenn das scheitert, malloc() versuchen
-                * und Daten ggf. "haendisch" umkopieren. (Haesslich! Eine wirklich
-                * dynamische Verwaltung waere wohl _deutlich_ besser ...) */
                ptr = (POINTER *)realloc( My_Connections, sizeof( CONNECTION ) * new_size );
                if( ! ptr )
                {
-                       /* realloc() ist fehlgeschlagen. Nun malloc() probieren: */
-                       ptr = (POINTER *)malloc( sizeof( CONNECTION ) * new_size );
-                       if( ! ptr )
-                       {
-                               /* Offenbar steht kein weiterer Sepeicher zur Verfuegung :-( */
-                               Log( LOG_EMERG, "Can't allocate memory! [New_Connection]" );
-                               Simple_Message( new_sock, "ERROR: Internal error" );
-                               close( new_sock );
-                               return;
-                       }
-
-                       /* Struktur umkopieren ... */
-                       memcpy( ptr, My_Connections, sizeof( CONNECTION ) * Pool_Size );
-
-#ifdef DEBUG
-                       Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [malloc()/memcpy()]", new_size, sizeof( CONNECTION ) * new_size );
-#endif
+                       Log( LOG_EMERG, "Can't allocate memory! [New_Connection]" );
+                       Simple_Message( new_sock, "ERROR: Internal error" );
+                       close( new_sock );
+                       return;
                }
+
 #ifdef DEBUG
-               else Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [realloc()]", new_size, sizeof( CONNECTION ) * new_size );
+               Log( LOG_DEBUG, "Allocated new connection pool for %ld items (%ld bytes). [realloc()]", new_size, sizeof( CONNECTION ) * new_size );
 #endif
 
                /* Adjust pointer to new block */