1 From a3410b0bc81ab03a889d9ffc14e351badf8372f1 Mon Sep 17 00:00:00 2001
2 From: Pierre Habouzit <madcoder@debian.org>
3 Date: Mon, 26 Nov 2007 16:02:04 +0100
4 Subject: [PATCH] Various fixes from the previous maintainer.
7 xinetd/child.c | 20 +++++++++++++++++---
8 xinetd/service.c | 8 ++++----
9 2 files changed, 21 insertions(+), 7 deletions(-)
11 diff --git a/xinetd/child.c b/xinetd/child.c
12 index 89ee54c..48e9615 100644
15 @@ -284,6 +284,7 @@ void child_process( struct server *serp )
16 connection_s *cp = SERVER_CONNECTION( serp ) ;
17 struct service_config *scp = SVC_CONF( sp ) ;
18 const char *func = "child_process" ;
21 signal_default_state();
23 @@ -296,9 +297,22 @@ void child_process( struct server *serp )
24 signals_pending[0] = -1;
25 signals_pending[1] = -1;
30 + if ( ( null_fd = open( "/dev/null", O_RDONLY ) ) == -1 )
32 + msg( LOG_ERR, func, "open('/dev/null') failed: %m") ;
36 + for ( fd = 0 ; fd <= MAX_PASS_FD ; fd++ )
38 + if ( fd != null_fd && dup2( null_fd, fd ) == -1 )
40 + msg( LOG_ERR, func, "dup2(%d, %d) failed: %m") ;
44 + if ( null_fd > MAX_PASS_FD )
45 + (void) Sclose( null_fd ) ;
49 diff --git a/xinetd/service.c b/xinetd/service.c
50 index 3d68d78..0132d6c 100644
51 --- a/xinetd/service.c
52 +++ b/xinetd/service.c
53 @@ -745,8 +745,8 @@ static status_e failed_service(struct service *sp,
57 - last = SAIN( calloc( 1, sizeof(union xsockaddr) ) );
58 - SVC_LAST_DGRAM_ADDR(sp) = (union xsockaddr *)last;
59 + SVC_LAST_DGRAM_ADDR(sp) = SAIN( calloc( 1, sizeof(union xsockaddr) ) );
60 + last = SAIN( SVC_LAST_DGRAM_ADDR(sp) );
63 (void) time( ¤t_time ) ;
64 @@ -772,8 +772,8 @@ static status_e failed_service(struct service *sp,
68 - last = SAIN6(calloc( 1, sizeof(union xsockaddr) ) );
69 - SVC_LAST_DGRAM_ADDR( sp ) = (union xsockaddr *)last;
70 + SVC_LAST_DGRAM_ADDR(sp) = SAIN6(calloc( 1, sizeof(union xsockaddr) ) );
71 + last = SAIN6(SVC_LAST_DGRAM_ADDR(sp));
74 (void) time( ¤t_time ) ;