builtins.c (xinetd-2.3.15) | : | builtins.c (xinetd-2.3.15.4.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
#include "config.h" | #include "config.h" | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <sys/socket.h> | #include <sys/socket.h> | |||
#include <netinet/in.h> | #include <netinet/in.h> | |||
#include <arpa/inet.h> | #include <arpa/inet.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <time.h> | #include <time.h> | |||
#include <syslog.h> | #include <syslog.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <unistd.h> | #include <unistd.h> | |||
#ifdef HAVE_NETDB_H | ||||
#include <netdb.h> | #include <netdb.h> | |||
#endif | ||||
#include "str.h" | #include "str.h" | |||
#include "pset.h" | #include "pset.h" | |||
#include "sio.h" | #include "sio.h" | |||
#include "builtins.h" | #include "builtins.h" | |||
#include "msg.h" | #include "msg.h" | |||
#include "connection.h" | #include "connection.h" | |||
#include "server.h" | #include "server.h" | |||
#include "service.h" | #include "service.h" | |||
#include "sconf.h" | #include "sconf.h" | |||
skipping to change at line 233 | skipping to change at line 231 | |||
static void daytime_protocol( char *buf, unsigned int *buflen ) | static void daytime_protocol( char *buf, unsigned int *buflen ) | |||
{ | { | |||
static const char *month_name[] = | static const char *month_name[] = | |||
{ | { | |||
"JAN", "FEB", "MAR", "APR", "MAY", "JUN", | "JAN", "FEB", "MAR", "APR", "MAY", "JUN", | |||
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC" | "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" | |||
} ; | } ; | |||
time_t now ; | time_t now ; | |||
struct tm *tmp ; | struct tm *tmp ; | |||
int size = *buflen ; | int size = *buflen ; | |||
#ifdef HAVE_STRFTIME | ||||
int cc ; | int cc ; | |||
#endif | ||||
(void) time( &now ) ; | (void) time( &now ) ; | |||
tmp = localtime( &now ) ; | tmp = localtime( &now ) ; | |||
#ifndef HAVE_STRFTIME | ||||
strx_print( buflen, buf, size, | ||||
"%02d %s %d %02d:%02d:%02d %s\r\n", | ||||
tmp->tm_mday, month_name[ tmp->tm_mon ], 1900 + tmp->tm_year, | ||||
tmp->tm_hour, tmp->tm_min, tmp->tm_sec, tmp->tm_zone ) ; | ||||
#else | ||||
cc = strx_nprint( buf, size, | cc = strx_nprint( buf, size, | |||
"%02d %s %d %02d:%02d:%02d", | "%02d %s %d %02d:%02d:%02d", | |||
tmp->tm_mday, month_name[ tmp->tm_mon ], 1900 + tmp->tm_year, | tmp->tm_mday, month_name[ tmp->tm_mon ], 1900 + tmp->tm_year, | |||
tmp->tm_hour, tmp->tm_min, tmp->tm_sec ) ; | tmp->tm_hour, tmp->tm_min, tmp->tm_sec ) ; | |||
if ( cc >= 0 ) { | if ( cc >= 0 ) { | |||
*buflen = cc ; | *buflen = cc ; | |||
size -= cc ; | size -= cc ; | |||
cc = strftime( &buf[ *buflen ], (size_t)size, " %Z\r\n", tmp ) ; | cc = strftime( &buf[ *buflen ], (size_t)size, " %Z\r\n", tmp ) ; | |||
*buflen += cc ; | *buflen += cc ; | |||
} | } | |||
#endif | ||||
} | } | |||
static void stream_daytime( const struct server *serp ) | static void stream_daytime( const struct server *serp ) | |||
{ | { | |||
char time_buf[ BUFFER_SIZE ] ; | char time_buf[ BUFFER_SIZE ] ; | |||
unsigned int buflen = sizeof( time_buf ) ; | unsigned int buflen = sizeof( time_buf ) ; | |||
int descriptor = SERVER_FD( serp ) ; | int descriptor = SERVER_FD( serp ) ; | |||
struct service *svc = SERVER_SERVICE( serp ) ;; | struct service *svc = SERVER_SERVICE( serp ) ;; | |||
if( SVC_WAITS( svc ) ) { | if( SVC_WAITS( svc ) ) { | |||
skipping to change at line 603 | skipping to change at line 592 | |||
if( SVC_WAITS( svc ) ) /* Service forks, so close it */ | if( SVC_WAITS( svc ) ) /* Service forks, so close it */ | |||
Sclose(descriptor); | Sclose(descriptor); | |||
server.svr_sp = sp; | server.svr_sp = sp; | |||
server.svr_conn = SERVER_CONNECTION(serp); | server.svr_conn = SERVER_CONNECTION(serp); | |||
nserp = server_alloc(&server); | nserp = server_alloc(&server); | |||
if( SC_IS_INTERNAL( scp ) ) { | if( SC_IS_INTERNAL( scp ) ) { | |||
SC_INTERNAL(scp, nserp); | SC_INTERNAL(scp, nserp); | |||
} else { | } else { | |||
exec_server(nserp); | child_process(nserp); | |||
} | } | |||
} | } | |||
End of changes. 7 change blocks. | ||||
12 lines changed or deleted | 1 lines changed or added |