Use some more specific data types (e. g. pid_t vs. int), make "SPLint" happy :-)
This commit is contained in:
parent
0a3f562f36
commit
dd3a3bc603
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: conf.c,v 1.90 2006/02/08 15:20:21 fw Exp $";
|
||||
static char UNUSED id[] = "$Id: conf.c,v 1.91 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -86,7 +86,7 @@ strdup_warn(const char *str)
|
|||
static void
|
||||
ports_puts(array *a)
|
||||
{
|
||||
unsigned int len;
|
||||
size_t len;
|
||||
UINT16 *ports;
|
||||
len = array_length(a, sizeof(UINT16));
|
||||
if (len--) {
|
||||
|
@ -223,7 +223,7 @@ Conf_Test( void )
|
|||
puts( "[SERVER]" );
|
||||
printf( " Name = %s\n", Conf_Server[i].name );
|
||||
printf( " Host = %s\n", Conf_Server[i].host );
|
||||
printf( " Port = %d\n", Conf_Server[i].port );
|
||||
printf( " Port = %u\n", (unsigned int)Conf_Server[i].port );
|
||||
printf( " MyPassword = %s\n", Conf_Server[i].pwd_in );
|
||||
printf( " PeerPassword = %s\n", Conf_Server[i].pwd_out );
|
||||
printf( " Group = %d\n\n", Conf_Server[i].group );
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: conf.h,v 1.39 2006/02/08 15:20:21 fw Exp $
|
||||
* $Id: conf.h,v 1.40 2006/05/10 21:24:01 alex Exp $
|
||||
*
|
||||
* Configuration management (header)
|
||||
*/
|
||||
|
@ -84,8 +84,8 @@ GLOBAL array Conf_ListenPorts;
|
|||
GLOBAL char Conf_ListenAddress[16];
|
||||
|
||||
/* User and group ID the server should run with */
|
||||
GLOBAL unsigned int Conf_UID;
|
||||
GLOBAL unsigned int Conf_GID;
|
||||
GLOBAL uid_t Conf_UID;
|
||||
GLOBAL gid_t Conf_GID;
|
||||
|
||||
/* A directory to chroot() in */
|
||||
GLOBAL char Conf_Chroot[FNAME_LEN];
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: conn-func.c,v 1.9 2006/04/23 10:37:27 fw Exp $";
|
||||
static char UNUSED id[] = "$Id: conn-func.c,v 1.10 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -156,7 +156,7 @@ Conn_Next( CONN_ID Idx )
|
|||
} /* Conn_Next */
|
||||
|
||||
|
||||
GLOBAL int
|
||||
GLOBAL UINT16
|
||||
Conn_Options( CONN_ID Idx )
|
||||
{
|
||||
assert( Idx > NONE );
|
||||
|
@ -185,7 +185,7 @@ Conn_StartTime( CONN_ID Idx )
|
|||
} /* Conn_StartTime */
|
||||
|
||||
|
||||
GLOBAL int
|
||||
GLOBAL size_t
|
||||
Conn_SendQ( CONN_ID Idx )
|
||||
{
|
||||
/* Laenge der Daten im Schreibbuffer liefern */
|
||||
|
@ -220,7 +220,7 @@ Conn_SendBytes( CONN_ID Idx )
|
|||
} /* Conn_SendBytes */
|
||||
|
||||
|
||||
GLOBAL int
|
||||
GLOBAL size_t
|
||||
Conn_RecvQ( CONN_ID Idx )
|
||||
{
|
||||
/* Laenge der Daten im Lesebuffer liefern */
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: conn-func.h,v 1.4 2005/04/25 18:37:16 fw Exp $
|
||||
* $Id: conn-func.h,v 1.5 2006/05/10 21:24:01 alex Exp $
|
||||
*
|
||||
* Connection management: Global functions (header)
|
||||
*/
|
||||
|
@ -30,8 +30,8 @@ GLOBAL void Conn_UpdateIdle PARAMS(( CONN_ID Idx ));
|
|||
GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL int Conn_SendQ PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL int Conn_RecvQ PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL size_t Conn_SendQ PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL size_t Conn_RecvQ PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL long Conn_SendMsg PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL long Conn_RecvMsg PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL long Conn_SendBytes PARAMS(( CONN_ID Idx ));
|
||||
|
@ -47,7 +47,7 @@ GLOBAL void Conn_SetFlag PARAMS(( CONN_ID Idx, int Flag ));
|
|||
GLOBAL CONN_ID Conn_First PARAMS(( void ));
|
||||
GLOBAL CONN_ID Conn_Next PARAMS(( CONN_ID Idx ));
|
||||
|
||||
GLOBAL int Conn_Options PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL UINT16 Conn_Options PARAMS(( CONN_ID Idx ));
|
||||
|
||||
GLOBAL void Conn_ResetWCounter PARAMS(( void ));
|
||||
GLOBAL long Conn_WCounter PARAMS(( void ));
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#ifdef ZLIB
|
||||
|
||||
static char UNUSED id[] = "$Id: conn-zip.c,v 1.9 2005/08/02 22:48:57 alex Exp $";
|
||||
static char UNUSED id[] = "$Id: conn-zip.c,v 1.10 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -80,7 +80,7 @@ Zip_InitConn( CONN_ID Idx )
|
|||
|
||||
|
||||
GLOBAL bool
|
||||
Zip_Buffer( CONN_ID Idx, char *Data, int Len )
|
||||
Zip_Buffer( CONN_ID Idx, char *Data, size_t Len )
|
||||
{
|
||||
/* Daten zum Komprimieren im "Kompressions-Puffer" sammeln.
|
||||
* Es wird true bei Erfolg, sonst false geliefert. */
|
||||
|
@ -90,14 +90,15 @@ Zip_Buffer( CONN_ID Idx, char *Data, int Len )
|
|||
assert( Len > 0 );
|
||||
assert( Len <= ZWRITEBUFFER_LEN );
|
||||
|
||||
if (Len < 0 || Len > ZWRITEBUFFER_LEN) return false;
|
||||
if (Len > ZWRITEBUFFER_LEN)
|
||||
return false;
|
||||
|
||||
if ( array_bytes( &My_Connections[Idx].zip.wbuf ) >= ZWRITEBUFFER_LEN ) {
|
||||
/* compression buffer is full, flush */
|
||||
if( ! Zip_Flush( Idx )) return false;
|
||||
}
|
||||
|
||||
return array_catb( &My_Connections[Idx].zip.wbuf, Data, Len );
|
||||
return array_catb(&My_Connections[Idx].zip.wbuf, Data, Len);
|
||||
} /* Zip_Buffer */
|
||||
|
||||
|
||||
|
@ -109,20 +110,19 @@ Zip_Flush( CONN_ID Idx )
|
|||
|
||||
int result;
|
||||
unsigned char zipbuf[WRITEBUFFER_LEN];
|
||||
unsigned int zipbuf_used = 0;
|
||||
int zipbuf_used = 0;
|
||||
z_stream *out;
|
||||
|
||||
out = &My_Connections[Idx].zip.out;
|
||||
|
||||
out->next_in = array_start(&My_Connections[Idx].zip.wbuf);
|
||||
assert(out->next_in);
|
||||
if (!out->next_in)
|
||||
return false;
|
||||
|
||||
out->avail_in = array_bytes(&My_Connections[Idx].zip.wbuf);
|
||||
out->avail_in = (uInt)array_bytes(&My_Connections[Idx].zip.wbuf);
|
||||
|
||||
out->next_out = zipbuf;
|
||||
out->avail_out = sizeof zipbuf;
|
||||
out->avail_out = (uInt)sizeof zipbuf;
|
||||
|
||||
Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d", out->avail_in, out->avail_out);
|
||||
result = deflate( out, Z_SYNC_FLUSH );
|
||||
|
@ -136,7 +136,8 @@ Zip_Flush( CONN_ID Idx )
|
|||
assert(out->avail_out <= WRITEBUFFER_LEN);
|
||||
zipbuf_used = WRITEBUFFER_LEN - out->avail_out;
|
||||
Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used);
|
||||
if (!array_catb( &My_Connections[Idx].wbuf, (char*) zipbuf, zipbuf_used ))
|
||||
if (!array_catb(&My_Connections[Idx].wbuf,
|
||||
(char *)zipbuf, (size_t) zipbuf_used))
|
||||
return false;
|
||||
|
||||
My_Connections[Idx].bytes_out += zipbuf_used;
|
||||
|
@ -156,7 +157,7 @@ Unzip_Buffer( CONN_ID Idx )
|
|||
|
||||
int result;
|
||||
unsigned char unzipbuf[READBUFFER_LEN];
|
||||
unsigned int unzipbuf_used = 0;
|
||||
int unzipbuf_used = 0;
|
||||
unsigned int z_rdatalen;
|
||||
unsigned int in_len;
|
||||
|
||||
|
@ -164,20 +165,19 @@ Unzip_Buffer( CONN_ID Idx )
|
|||
|
||||
assert( Idx > NONE );
|
||||
|
||||
z_rdatalen = array_bytes(&My_Connections[Idx].zip.rbuf);
|
||||
z_rdatalen = (unsigned int)array_bytes(&My_Connections[Idx].zip.rbuf);
|
||||
if (z_rdatalen == 0)
|
||||
return true;
|
||||
|
||||
in = &My_Connections[Idx].zip.in;
|
||||
|
||||
in->next_in = array_start(&My_Connections[Idx].zip.rbuf);
|
||||
assert(in->next_in);
|
||||
if (!in->next_in)
|
||||
return false;
|
||||
|
||||
in->avail_in = z_rdatalen;
|
||||
in->next_out = unzipbuf;
|
||||
in->avail_out = sizeof unzipbuf;
|
||||
in->avail_out = (uInt)sizeof unzipbuf;
|
||||
|
||||
Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d", in->avail_in, in->avail_out);
|
||||
result = inflate( in, Z_SYNC_FLUSH );
|
||||
|
@ -193,7 +193,8 @@ Unzip_Buffer( CONN_ID Idx )
|
|||
unzipbuf_used = READBUFFER_LEN - in->avail_out;
|
||||
Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN, in->avail_out, unzipbuf_used);
|
||||
assert(unzipbuf_used <= READBUFFER_LEN);
|
||||
if (!array_catb(&My_Connections[Idx].rbuf, (char*) unzipbuf, unzipbuf_used))
|
||||
if (!array_catb(&My_Connections[Idx].rbuf, (char*) unzipbuf,
|
||||
(size_t)unzipbuf_used))
|
||||
return false;
|
||||
|
||||
if( in->avail_in > 0 ) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: conn-zip.h,v 1.3 2005/03/19 18:43:48 fw Exp $
|
||||
* $Id: conn-zip.h,v 1.4 2006/05/10 21:24:01 alex Exp $
|
||||
*
|
||||
* Connection compression using ZLIB (header)
|
||||
*/
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
GLOBAL bool Zip_InitConn PARAMS(( CONN_ID Idx ));
|
||||
|
||||
GLOBAL bool Zip_Buffer PARAMS(( CONN_ID Idx, char *Data, int Len ));
|
||||
GLOBAL bool Zip_Buffer PARAMS(( CONN_ID Idx, char *Data, size_t Len ));
|
||||
GLOBAL bool Zip_Flush PARAMS(( CONN_ID Idx ));
|
||||
GLOBAL bool Unzip_Buffer PARAMS(( CONN_ID Idx ));
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "portab.h"
|
||||
#include "io.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: conn.c,v 1.194 2006/05/09 14:49:08 alex Exp $";
|
||||
static char UNUSED id[] = "$Id: conn.c,v 1.195 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -216,12 +216,13 @@ Conn_Init( void )
|
|||
if( Pool_Size > Conf_MaxConnections ) Pool_Size = Conf_MaxConnections;
|
||||
}
|
||||
|
||||
if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), Pool_Size)) {
|
||||
if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)Pool_Size)) {
|
||||
Log( LOG_EMERG, "Can't allocate memory! [Conn_Init]" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
/* XXX: My_Connetions/Pool_Size are needed by other parts of the code; remove them */
|
||||
/* FIXME: My_Connetions/Pool_Size is needed by other parts of the
|
||||
* code; remove them! */
|
||||
My_Connections = (CONNECTION*) array_start(&My_ConnArray);
|
||||
|
||||
LogDebug("Allocated connection pool for %d items (%ld bytes).",
|
||||
|
@ -266,10 +267,11 @@ Conn_Exit( void )
|
|||
} /* Conn_Exit */
|
||||
|
||||
|
||||
static unsigned int
|
||||
static int
|
||||
ports_initlisteners(array *a, void (*func)(int,short))
|
||||
{
|
||||
unsigned int created = 0, len;
|
||||
int created = 0;
|
||||
size_t len;
|
||||
int fd;
|
||||
UINT16 *port;
|
||||
|
||||
|
@ -301,7 +303,7 @@ Conn_InitListeners( void )
|
|||
{
|
||||
/* Initialize ports on which the server should accept connections */
|
||||
|
||||
unsigned int created;
|
||||
int created;
|
||||
|
||||
if (!io_library_init(CONNECTION_POOL)) {
|
||||
Log(LOG_EMERG, "Cannot initialize IO routines: %s", strerror(errno));
|
||||
|
@ -328,7 +330,7 @@ Conn_ExitListeners( void )
|
|||
Log( LOG_INFO, "Shutting down all listening sockets (%d total)...", arraylen );
|
||||
fd = array_start(&My_Listeners);
|
||||
while(arraylen--) {
|
||||
assert(fd);
|
||||
assert(fd != NULL);
|
||||
assert(*fd >= 0);
|
||||
io_close(*fd);
|
||||
LogDebug("Listening socket %d closed.", *fd );
|
||||
|
@ -354,7 +356,7 @@ NewListener( const UINT16 Port )
|
|||
/* Server-"Listen"-Socket initialisieren */
|
||||
memset( &addr, 0, sizeof( addr ));
|
||||
memset( &inaddr, 0, sizeof( inaddr ));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_family = (sa_family_t)AF_INET;
|
||||
addr.sin_port = htons( Port );
|
||||
if( Conf_ListenAddress[0] )
|
||||
{
|
||||
|
@ -381,7 +383,7 @@ NewListener( const UINT16 Port )
|
|||
|
||||
if( ! Init_Socket( sock )) return -1;
|
||||
|
||||
if( bind( sock, (struct sockaddr *)&addr, (socklen_t)sizeof( addr )) != 0 ) {
|
||||
if (bind(sock, (struct sockaddr *)&addr, (int)sizeof(addr)) != 0) {
|
||||
Log( LOG_CRIT, "Can't bind socket: %s!", strerror( errno ));
|
||||
close( sock );
|
||||
return -1;
|
||||
|
@ -424,8 +426,11 @@ NewListener( const UINT16 Port )
|
|||
}
|
||||
|
||||
/* Add port number to description if non-standard */
|
||||
if( Port != 6667 ) snprintf( name, sizeof( name ), "%s (port %u)", info, Port );
|
||||
else strlcpy( name, info, sizeof( name ));
|
||||
if (Port != 6667)
|
||||
snprintf(name, sizeof name, "%s (port %u)", info,
|
||||
(unsigned int)Port);
|
||||
else
|
||||
strlcpy(name, info, sizeof name);
|
||||
|
||||
/* Register service */
|
||||
Rendezvous_Register( name, MDNS_TYPE, Port );
|
||||
|
@ -482,7 +487,7 @@ Conn_Handler( void )
|
|||
if ( My_Connections[i].sock <= NONE )
|
||||
continue;
|
||||
|
||||
wdatalen = array_bytes(&My_Connections[i].wbuf);
|
||||
wdatalen = (unsigned int)array_bytes(&My_Connections[i].wbuf);
|
||||
|
||||
#ifdef ZLIB
|
||||
if (( wdatalen > 0 ) || ( array_bytes(&My_Connections[i].zip.wbuf)> 0 ))
|
||||
|
@ -611,7 +616,7 @@ va_dcl
|
|||
|
||||
|
||||
GLOBAL bool
|
||||
Conn_Write( CONN_ID Idx, char *Data, unsigned int Len )
|
||||
Conn_Write( CONN_ID Idx, char *Data, size_t Len )
|
||||
{
|
||||
/* Daten in Socket schreiben. Bei "fatalen" Fehlern wird
|
||||
* der Client disconnectiert und false geliefert. */
|
||||
|
@ -824,13 +829,14 @@ Conn_SyncServerStruct( void )
|
|||
} /* SyncServerStruct */
|
||||
|
||||
|
||||
/**
|
||||
* Send out data of write buffer; connect new sockets.
|
||||
*/
|
||||
static bool
|
||||
Handle_Write( CONN_ID Idx )
|
||||
{
|
||||
/* Daten aus Schreibpuffer versenden bzw. Connection aufbauen */
|
||||
|
||||
int len;
|
||||
unsigned int wdatalen;
|
||||
ssize_t len;
|
||||
size_t wdatalen;
|
||||
|
||||
assert( Idx > NONE );
|
||||
if ( My_Connections[Idx].sock < 0 ) {
|
||||
|
@ -876,7 +882,7 @@ Handle_Write( CONN_ID Idx )
|
|||
}
|
||||
|
||||
/* move any data not yet written to beginning */
|
||||
array_moveleft(&My_Connections[Idx].wbuf, 1, len);
|
||||
array_moveleft(&My_Connections[Idx].wbuf, 1, (size_t)len);
|
||||
|
||||
return true;
|
||||
} /* Handle_Write */
|
||||
|
@ -898,11 +904,11 @@ New_Connection( int Sock )
|
|||
|
||||
assert( Sock > NONE );
|
||||
/* Connection auf Listen-Socket annehmen */
|
||||
new_sock_len = sizeof( new_addr );
|
||||
new_sock = accept( Sock, (struct sockaddr *)&new_addr, (socklen_t *)&new_sock_len );
|
||||
if( new_sock < 0 )
|
||||
{
|
||||
Log( LOG_CRIT, "Can't accept connection: %s!", strerror( errno ));
|
||||
new_sock_len = (int)sizeof new_addr;
|
||||
new_sock = accept(Sock, (struct sockaddr *)&new_addr,
|
||||
(socklen_t *)&new_sock_len);
|
||||
if (new_sock < 0) {
|
||||
Log(LOG_CRIT, "Can't accept connection: %s!", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -947,7 +953,8 @@ New_Connection( int Sock )
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (!array_alloc(&My_ConnArray, sizeof( CONNECTION ), new_sock)) {
|
||||
if (!array_alloc(&My_ConnArray, sizeof(CONNECTION),
|
||||
(size_t)new_sock)) {
|
||||
Log( LOG_EMERG, "Can't allocate memory! [New_Connection]" );
|
||||
Simple_Message( new_sock, "ERROR: Internal error" );
|
||||
close( new_sock );
|
||||
|
@ -1023,7 +1030,7 @@ Read_Request( CONN_ID Idx )
|
|||
/* Daten von Socket einlesen und entsprechend behandeln.
|
||||
* Tritt ein Fehler auf, so wird der Socket geschlossen. */
|
||||
|
||||
int len;
|
||||
ssize_t len;
|
||||
char readbuf[1024];
|
||||
CLIENT *c;
|
||||
|
||||
|
@ -1061,10 +1068,14 @@ Read_Request( CONN_ID Idx )
|
|||
return;
|
||||
}
|
||||
#ifdef ZLIB
|
||||
if ( Conn_OPTION_ISSET( &My_Connections[Idx], CONN_ZIP )) {
|
||||
if (!array_catb( &My_Connections[Idx].zip.rbuf, readbuf, len)) {
|
||||
Log( LOG_ERR, "Could not append recieved data to zip input buffer (connn %d): %d bytes!", Idx, len );
|
||||
Conn_Close( Idx, "Receive buffer overflow!", NULL, false );
|
||||
if (Conn_OPTION_ISSET(&My_Connections[Idx], CONN_ZIP)) {
|
||||
if (!array_catb(&My_Connections[Idx].zip.rbuf, readbuf,
|
||||
(size_t) len)) {
|
||||
Log(LOG_ERR,
|
||||
"Could not append recieved data to zip input buffer (connn %d): %d bytes!",
|
||||
Idx, len);
|
||||
Conn_Close(Idx, "Receive buffer overflow!", NULL,
|
||||
false);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
|
@ -1107,7 +1118,7 @@ Handle_Buffer( CONN_ID Idx )
|
|||
char *ptr1, *ptr2;
|
||||
#endif
|
||||
char *ptr;
|
||||
int len, delta;
|
||||
size_t len, delta;
|
||||
bool result;
|
||||
time_t starttime;
|
||||
#ifdef ZLIB
|
||||
|
@ -1156,7 +1167,7 @@ Handle_Buffer( CONN_ID Idx )
|
|||
|
||||
len = ( ptr - (char*) array_start(&My_Connections[Idx].rbuf)) + delta;
|
||||
|
||||
if( len < 0 || len > ( COMMAND_LEN - 1 )) {
|
||||
if( len > ( COMMAND_LEN - 1 )) {
|
||||
/* Request must not exceed 512 chars (incl. CR+LF!), see
|
||||
* RFC 2812. Disconnect Client if this happens. */
|
||||
Log( LOG_ERR, "Request too long (connection %d): %d bytes (max. %d expected)!",
|
||||
|
@ -1331,7 +1342,7 @@ New_Server( int Server )
|
|||
}
|
||||
|
||||
memset( &new_addr, 0, sizeof( new_addr ));
|
||||
new_addr.sin_family = AF_INET;
|
||||
new_addr.sin_family = (sa_family_t)AF_INET;
|
||||
new_addr.sin_addr = inaddr;
|
||||
new_addr.sin_port = htons( Conf_Server[Server].port );
|
||||
|
||||
|
@ -1343,15 +1354,18 @@ New_Server( int Server )
|
|||
|
||||
if( ! Init_Socket( new_sock )) return;
|
||||
|
||||
res = connect( new_sock, (struct sockaddr *)&new_addr, sizeof( new_addr ));
|
||||
res = connect(new_sock, (struct sockaddr *)&new_addr,
|
||||
(socklen_t)sizeof(new_addr));
|
||||
if(( res != 0 ) && ( errno != EINPROGRESS )) {
|
||||
Log( LOG_CRIT, "Can't connect socket: %s!", strerror( errno ));
|
||||
close( new_sock );
|
||||
return;
|
||||
}
|
||||
|
||||
if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), new_sock)) {
|
||||
Log( LOG_ALERT, "Cannot allocate memory for server connection (socket %d)", new_sock);
|
||||
if (!array_alloc(&My_ConnArray, sizeof(CONNECTION), (size_t)new_sock)) {
|
||||
Log(LOG_ALERT,
|
||||
"Cannot allocate memory for server connection (socket %d)",
|
||||
new_sock);
|
||||
close( new_sock );
|
||||
return;
|
||||
}
|
||||
|
@ -1598,7 +1612,7 @@ Conn_GetClient( CONN_ID Idx )
|
|||
CONNECTION *c;
|
||||
assert( Idx >= 0 );
|
||||
|
||||
c = array_get(&My_ConnArray, sizeof (CONNECTION), Idx);
|
||||
c = array_get(&My_ConnArray, sizeof (CONNECTION), (size_t)Idx);
|
||||
|
||||
assert(c != NULL);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: conn.h,v 1.41 2006/04/23 10:37:27 fw Exp $
|
||||
* $Id: conn.h,v 1.42 2006/05/10 21:24:01 alex Exp $
|
||||
*
|
||||
* Connection management (header)
|
||||
*/
|
||||
|
@ -88,7 +88,7 @@ GLOBAL void Conn_ExitListeners PARAMS(( void ));
|
|||
|
||||
GLOBAL void Conn_Handler PARAMS(( void ));
|
||||
|
||||
GLOBAL bool Conn_Write PARAMS(( CONN_ID Idx, char *Data, unsigned int Len ));
|
||||
GLOBAL bool Conn_Write PARAMS(( CONN_ID Idx, char *Data, size_t Len ));
|
||||
GLOBAL bool Conn_WriteStr PARAMS(( CONN_ID Idx, char *Format, ... ));
|
||||
|
||||
GLOBAL void Conn_Close PARAMS(( CONN_ID Idx, char *LogMsg, char *FwdMsg, bool InformClient ));
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: irc-info.c,v 1.32 2006/04/23 10:37:27 fw Exp $";
|
||||
static char UNUSED id[] = "$Id: irc-info.c,v 1.33 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -913,7 +913,7 @@ IRC_Show_MOTD( CLIENT *Client )
|
|||
if (!Show_MOTD_Start( Client ))
|
||||
return DISCONNECTED;
|
||||
|
||||
while (fgets( line, sizeof( line ), fd )) {
|
||||
while (fgets( line, (int)sizeof line, fd )) {
|
||||
ngt_TrimLastChr( line, '\n');
|
||||
|
||||
if( ! Show_MOTD_Sendline( Client, line)) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: irc-mode.c,v 1.44 2005/07/31 20:13:08 alex Exp $";
|
||||
static char UNUSED id[] = "$Id: irc-mode.c,v 1.45 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -71,15 +71,20 @@ IRC_MODE( CLIENT *Client, REQUEST *Req )
|
|||
else origin = Client;
|
||||
|
||||
/* Channel or user mode? */
|
||||
cl = chan = NULL;
|
||||
if( Client_IsValidNick( Req->argv[0] )) cl = Client_Search( Req->argv[0] );
|
||||
if( Channel_IsValidName( Req->argv[0] )) chan = Channel_Search( Req->argv[0] );
|
||||
cl = NULL; chan = NULL;
|
||||
if (Client_IsValidNick(Req->argv[0]))
|
||||
cl = Client_Search(Req->argv[0]);
|
||||
if (Channel_IsValidName(Req->argv[0]))
|
||||
chan = Channel_Search(Req->argv[0]);
|
||||
|
||||
if( cl ) return Client_Mode( Client, Req, origin, cl );
|
||||
if( chan ) return Channel_Mode( Client, Req, origin, chan );
|
||||
if (cl)
|
||||
return Client_Mode(Client, Req, origin, cl);
|
||||
if (chan)
|
||||
return Channel_Mode(Client, Req, origin, chan);
|
||||
|
||||
/* No target found! */
|
||||
return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->argv[0] );
|
||||
return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
|
||||
Client_ID(Client), Req->argv[0]);
|
||||
} /* IRC_MODE */
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: irc-oper.c,v 1.25 2006/04/23 10:37:27 fw Exp $";
|
||||
static char UNUSED id[] = "$Id: irc-oper.c,v 1.26 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -150,35 +150,52 @@ IRC_RESTART( CLIENT *Client, REQUEST *Req )
|
|||
} /* IRC_RESTART */
|
||||
|
||||
|
||||
/**
|
||||
* Connect configured or new server.
|
||||
*/
|
||||
GLOBAL bool
|
||||
IRC_CONNECT(CLIENT *Client, REQUEST *Req )
|
||||
IRC_CONNECT(CLIENT * Client, REQUEST * Req)
|
||||
{
|
||||
/* Connect configured or new server */
|
||||
|
||||
assert( Client != NULL );
|
||||
assert( Req != NULL );
|
||||
assert(Client != NULL);
|
||||
assert(Req != NULL);
|
||||
|
||||
/* Not a local IRC operator? */
|
||||
if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client ));
|
||||
if ((!Client_HasMode(Client, 'o')) || (!Client_OperByMe(Client)))
|
||||
return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG,
|
||||
Client_ID(Client));
|
||||
|
||||
/* Bad number of parameters? */
|
||||
if(( Req->argc != 2 ) && ( Req->argc != 5 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||
if ((Req->argc != 2) && (Req->argc != 5))
|
||||
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
||||
Client_ID(Client), Req->command);
|
||||
|
||||
/* Invalid port number? */
|
||||
if( atoi( Req->argv[1] ) < 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
|
||||
if (atoi(Req->argv[1]) < 1)
|
||||
return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
|
||||
Client_ID(Client), Req->command);
|
||||
|
||||
Log( LOG_NOTICE|LOG_snotice, "Got CONNECT command from \"%s\" for \"%s\".", Client_Mask( Client ), Req->argv[0]);
|
||||
Log(LOG_NOTICE | LOG_snotice,
|
||||
"Got CONNECT command from \"%s\" for \"%s\".", Client_Mask(Client),
|
||||
Req->argv[0]);
|
||||
|
||||
if( Req->argc == 2 )
|
||||
{
|
||||
if (Req->argc == 2) {
|
||||
/* Connect configured server */
|
||||
if( ! Conf_EnableServer( Req->argv[0], atoi( Req->argv[1] ))) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Conf_EnableServer
|
||||
(Req->argv[0], (UINT16) atoi(Req->argv[1])))
|
||||
return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
|
||||
Client_ID(Client),
|
||||
Req->argv[0]);
|
||||
} else {
|
||||
/* Add server */
|
||||
if( ! Conf_AddServer( Req->argv[0], atoi( Req->argv[1] ), Req->argv[2], Req->argv[3], Req->argv[4] )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] );
|
||||
if (!Conf_AddServer
|
||||
(Req->argv[0], (UINT16) atoi(Req->argv[1]), Req->argv[2],
|
||||
Req->argv[3], Req->argv[4]))
|
||||
return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG,
|
||||
Client_ID(Client),
|
||||
Req->argv[0]);
|
||||
}
|
||||
|
||||
return CONNECTED;
|
||||
} /* IRC_CONNECT */
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: irc-write.c,v 1.19 2005/07/31 20:13:08 alex Exp $";
|
||||
static char UNUSED id[] = "$Id: irc-write.c,v 1.20 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -400,7 +400,7 @@ va_dcl
|
|||
|
||||
|
||||
GLOBAL void
|
||||
IRC_SetPenalty( CLIENT *Client, int Seconds )
|
||||
IRC_SetPenalty( CLIENT *Client, time_t Seconds )
|
||||
{
|
||||
CONN_ID c;
|
||||
|
||||
|
@ -410,7 +410,8 @@ IRC_SetPenalty( CLIENT *Client, int Seconds )
|
|||
if( Client_Type( Client ) == CLIENT_SERVER ) return;
|
||||
|
||||
c = Client_Conn( Client );
|
||||
if( c > NONE ) Conn_SetPenalty( c, Seconds );
|
||||
if (c > NONE)
|
||||
Conn_SetPenalty(c, Seconds);
|
||||
} /* IRC_SetPenalty */
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: irc-write.h,v 1.7 2005/03/19 18:43:49 fw Exp $
|
||||
* $Id: irc-write.h,v 1.8 2006/05/10 21:24:01 alex Exp $
|
||||
*
|
||||
* Sending IRC commands over the network (header)
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ GLOBAL void IRC_WriteStrServersPrefixFlag PARAMS(( CLIENT *ExceptOf, CLIENT *Pre
|
|||
|
||||
GLOBAL bool IRC_WriteStrRelatedPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, bool Remote, char *Format, ... ));
|
||||
|
||||
GLOBAL void IRC_SetPenalty PARAMS(( CLIENT *Client, int Seconds ));
|
||||
GLOBAL void IRC_SetPenalty PARAMS(( CLIENT *Client, time_t Seconds ));
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: irc.c,v 1.129 2006/04/23 10:37:27 fw Exp $";
|
||||
static char UNUSED id[] = "$Id: irc.c,v 1.130 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -329,13 +329,15 @@ static char *
|
|||
Option_String( CONN_ID Idx )
|
||||
{
|
||||
static char option_txt[8];
|
||||
int options;
|
||||
UINT16 options;
|
||||
|
||||
options = Conn_Options( Idx );
|
||||
options = Conn_Options(Idx);
|
||||
|
||||
strcpy( option_txt, "F" ); /* No idea what this means but the original ircd sends it ... */
|
||||
strcpy(option_txt, "F"); /* No idea what this means, but the
|
||||
* original ircd sends it ... */
|
||||
#ifdef ZLIB
|
||||
if( options & CONN_ZIP ) strcat( option_txt, "z" );
|
||||
if(options & CONN_ZIP) /* zlib compression supported. */
|
||||
strcat(option_txt, "z");
|
||||
#endif
|
||||
|
||||
return option_txt;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: ngircd.c,v 1.111 2005/11/21 16:31:30 alex Exp $";
|
||||
static char UNUSED id[] = "$Id: ngircd.c,v 1.112 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
/**
|
||||
* @file
|
||||
|
@ -62,7 +62,7 @@ static void Signal_Handler PARAMS(( int Signal ));
|
|||
static void Show_Version PARAMS(( void ));
|
||||
static void Show_Help PARAMS(( void ));
|
||||
|
||||
static void Pidfile_Create PARAMS(( long ));
|
||||
static void Pidfile_Create PARAMS(( pid_t pid ));
|
||||
static void Pidfile_Delete PARAMS(( void ));
|
||||
|
||||
static void Fill_Version PARAMS(( void ));
|
||||
|
@ -601,7 +601,7 @@ Pidfile_Delete( void )
|
|||
* @param pid The process ID to be stored in this file.
|
||||
*/
|
||||
static void
|
||||
Pidfile_Create( long pid )
|
||||
Pidfile_Create(pid_t pid)
|
||||
{
|
||||
int pidfd;
|
||||
char pidbuf[64];
|
||||
|
@ -620,13 +620,13 @@ Pidfile_Create( long pid )
|
|||
return;
|
||||
}
|
||||
|
||||
len = snprintf( pidbuf, sizeof pidbuf, "%ld\n", pid );
|
||||
if (len < 0|| len < (int)sizeof pid) {
|
||||
len = snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid);
|
||||
if (len < 0 || len >= (int)sizeof pidbuf) {
|
||||
Log( LOG_ERR, "Error converting pid");
|
||||
return;
|
||||
}
|
||||
|
||||
if( write( pidfd, pidbuf, len) != len)
|
||||
if (write(pidfd, pidbuf, (size_t)len) != (ssize_t)len)
|
||||
Log( LOG_ERR, "Can't write PID file (%s): %s", Conf_PidFile, strerror( errno ));
|
||||
|
||||
if( close(pidfd) != 0 )
|
||||
|
@ -663,7 +663,7 @@ Setup_FDStreams( void )
|
|||
|
||||
|
||||
static bool
|
||||
NGIRCd_getNobodyID(unsigned int *uid, unsigned int *gid )
|
||||
NGIRCd_getNobodyID(uid_t *uid, gid_t *gid )
|
||||
{
|
||||
struct passwd *pwd;
|
||||
|
||||
|
@ -689,7 +689,7 @@ NGIRCd_Init( bool NGIRCd_NoDaemon )
|
|||
struct passwd *pwd;
|
||||
struct group *grp;
|
||||
int real_errno;
|
||||
long pid;
|
||||
pid_t pid;
|
||||
|
||||
if (initialized)
|
||||
return true;
|
||||
|
@ -749,7 +749,7 @@ NGIRCd_Init( bool NGIRCd_NoDaemon )
|
|||
* connected to ther controlling terminal. Use "--nodaemon"
|
||||
* to disable this "daemon mode" (useful for debugging). */
|
||||
if ( ! NGIRCd_NoDaemon ) {
|
||||
pid = (long)fork( );
|
||||
pid = fork( );
|
||||
if( pid > 0 ) {
|
||||
/* "Old" process: exit. */
|
||||
exit( 0 );
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#ifdef ZEROCONF
|
||||
|
||||
|
||||
static char UNUSED id[] = "$Id: rendezvous.c,v 1.7 2005/07/31 20:13:08 alex Exp $";
|
||||
static char UNUSED id[] = "$Id: rendezvous.c,v 1.8 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -144,7 +144,7 @@ GLOBAL void Rendezvous_Exit( void )
|
|||
} /* Rendezvous_Exit */
|
||||
|
||||
|
||||
GLOBAL bool Rendezvous_Register( char *Name, char *Type, unsigned int Port )
|
||||
GLOBAL bool Rendezvous_Register( char *Name, char *Type, UINT16 Port )
|
||||
{
|
||||
/* Register new service */
|
||||
|
||||
|
@ -310,7 +310,8 @@ static void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType Err
|
|||
strcpy( txt, "name conflict!" );
|
||||
break;
|
||||
default:
|
||||
sprintf( txt, "error code %ld!", (long)ErrCode );
|
||||
snprintf(txt, sizeof txt, "error code %ld!",
|
||||
(long)ErrCode);
|
||||
}
|
||||
|
||||
Log( LOG_INFO, "Can't register \"%s\" with Rendezvous: %s", s->Desc, txt );
|
||||
|
@ -347,7 +348,8 @@ static sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_d
|
|||
strcpy( txt, "name conflict!" );
|
||||
break;
|
||||
default:
|
||||
sprintf( txt, "error code %ld!", (long)Status );
|
||||
snprintf(txt, sizeof txt, "error code %ld!",
|
||||
(long)Status);
|
||||
}
|
||||
|
||||
Log( LOG_INFO, "Can't register \"%s\" with Rendezvous: %s", s->Desc, txt );
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: rendezvous.h,v 1.3 2005/07/08 16:18:39 alex Exp $
|
||||
* $Id: rendezvous.h,v 1.4 2006/05/10 21:24:01 alex Exp $
|
||||
*
|
||||
* "Rendezvous" functions (Header)
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@
|
|||
GLOBAL void Rendezvous_Init( void );
|
||||
GLOBAL void Rendezvous_Exit( void );
|
||||
|
||||
GLOBAL bool Rendezvous_Register( char *Name, char *Type, unsigned int Port );
|
||||
GLOBAL bool Rendezvous_Register( char *Name, char *Type, UINT16 Port );
|
||||
|
||||
GLOBAL bool Rendezvous_Unregister( char *Name );
|
||||
GLOBAL void Rendezvous_UnregisterListeners( void );
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "portab.h"
|
||||
|
||||
static char UNUSED id[] = "$Id: resolve.c,v 1.23 2006/02/08 15:24:10 fw Exp $";
|
||||
static char UNUSED id[] = "$Id: resolve.c,v 1.24 2006/05/10 21:24:01 alex Exp $";
|
||||
|
||||
#include "imp.h"
|
||||
#include <assert.h>
|
||||
|
@ -50,10 +50,11 @@ static bool register_callback PARAMS((RES_STAT *s, void (*cbfunc)(int, short)));
|
|||
static char *Get_Error PARAMS(( int H_Error ));
|
||||
#endif
|
||||
|
||||
static int
|
||||
static pid_t
|
||||
Resolver_fork(int *pipefds)
|
||||
{
|
||||
int pid;
|
||||
pid_t pid;
|
||||
|
||||
if (pipe(pipefds) != 0) {
|
||||
Log( LOG_ALERT, "Resolver: Can't create output pipe: %s!", strerror( errno ));
|
||||
return -1;
|
||||
|
@ -77,11 +78,16 @@ Resolver_fork(int *pipefds)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resolve IP (asynchronous!).
|
||||
*/
|
||||
GLOBAL bool
|
||||
Resolve_Addr( RES_STAT *s, struct sockaddr_in *Addr, int identsock, void (*cbfunc)(int, short))
|
||||
Resolve_Addr(RES_STAT * s, struct sockaddr_in *Addr, int identsock,
|
||||
void (*cbfunc) (int, short))
|
||||
{
|
||||
/* Resolve IP (asynchronous!). */
|
||||
int pid, pipefd[2];
|
||||
int pipefd[2];
|
||||
pid_t pid;
|
||||
|
||||
assert(s != NULL);
|
||||
|
||||
pid = Resolver_fork(pipefd);
|
||||
|
@ -102,11 +108,15 @@ Resolve_Addr( RES_STAT *s, struct sockaddr_in *Addr, int identsock, void (*cbfun
|
|||
} /* Resolve_Addr */
|
||||
|
||||
|
||||
/**
|
||||
* Resolve hostname (asynchronous!).
|
||||
*/
|
||||
GLOBAL bool
|
||||
Resolve_Name( RES_STAT *s, const char *Host, void (*cbfunc)(int, short))
|
||||
{
|
||||
/* Resolve hostname (asynchronous!). */
|
||||
int pid, pipefd[2];
|
||||
int pipefd[2];
|
||||
pid_t pid;
|
||||
|
||||
assert(s != NULL);
|
||||
|
||||
pid = Resolver_fork(pipefd);
|
||||
|
@ -236,7 +246,7 @@ Do_ResolveName( const char *Host, int w_fd )
|
|||
char ip[16];
|
||||
struct hostent *h;
|
||||
struct in_addr *addr;
|
||||
int len;
|
||||
size_t len;
|
||||
|
||||
Log_Resolver( LOG_DEBUG, "Now resolving \"%s\" ...", Host );
|
||||
|
||||
|
@ -259,7 +269,7 @@ Do_ResolveName( const char *Host, int w_fd )
|
|||
#endif
|
||||
/* Write result into pipe to parent */
|
||||
len = strlen( ip );
|
||||
if( write( w_fd, ip, len ) != len) {
|
||||
if ((size_t)write( w_fd, ip, len ) != len) {
|
||||
Log_Resolver( LOG_CRIT, "Resolver: Can't write to parent: %s!", strerror( errno ));
|
||||
close( w_fd );
|
||||
}
|
||||
|
@ -294,7 +304,7 @@ Get_Error( int H_Error )
|
|||
static bool
|
||||
register_callback( RES_STAT *s, void (*cbfunc)(int, short))
|
||||
{
|
||||
assert(cbfunc);
|
||||
assert(cbfunc != NULL);
|
||||
assert(s != NULL);
|
||||
assert(s->resolver_fd >= 0);
|
||||
|
||||
|
@ -324,11 +334,15 @@ Resolve_Shutdown( RES_STAT *s)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read result of resolver sub-process from pipe
|
||||
*/
|
||||
GLOBAL size_t
|
||||
Resolve_Read( RES_STAT *s, void* readbuf, size_t buflen)
|
||||
{
|
||||
/* Read result of resolver sub-process from pipe */
|
||||
int err, bytes_read;
|
||||
int err;
|
||||
ssize_t bytes_read;
|
||||
|
||||
assert(buflen > 0);
|
||||
|
||||
/* Read result from pipe */
|
||||
|
@ -353,7 +367,7 @@ Resolve_Read( RES_STAT *s, void* readbuf, size_t buflen)
|
|||
return 0;
|
||||
}
|
||||
|
||||
return bytes_read;
|
||||
return (size_t)bytes_read;
|
||||
}
|
||||
/* -eof- */
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* (at your option) any later version.
|
||||
* Please read the file COPYING, README and AUTHORS for more information.
|
||||
*
|
||||
* $Id: resolve.h,v 1.12 2006/02/08 15:24:10 fw Exp $
|
||||
* $Id: resolve.h,v 1.13 2006/05/10 21:24:02 alex Exp $
|
||||
*
|
||||
* Asynchronous resolver (header)
|
||||
*/
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
/* This struct must not be accessed directly */
|
||||
typedef struct _Res_Stat {
|
||||
int pid; /* PID of resolver process */
|
||||
pid_t pid; /* PID of resolver process */
|
||||
int resolver_fd; /* pipe fd for lookup result. */
|
||||
} RES_STAT;
|
||||
|
||||
|
|
Loading…
Reference in New Issue