summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch')
-rw-r--r--meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch b/meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch
new file mode 100644
index 0000000000..d243692769
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch
@@ -0,0 +1,77 @@
1From a3410b0bc81ab03a889d9ffc14e351badf8372f1 Mon Sep 17 00:00:00 2001
2From: Pierre Habouzit <madcoder@debian.org>
3Date: Mon, 26 Nov 2007 16:02:04 +0100
4Subject: [PATCH] Various fixes from the previous maintainer.
5
6---
7 xinetd/child.c | 20 +++++++++++++++++---
8 xinetd/service.c | 8 ++++----
9 2 files changed, 21 insertions(+), 7 deletions(-)
10
11diff --git a/xinetd/child.c b/xinetd/child.c
12index 89ee54c..48e9615 100644
13--- a/xinetd/child.c
14+++ b/xinetd/child.c
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" ;
19+ int fd, null_fd;
20
21 signal_default_state();
22
23@@ -296,9 +297,22 @@ void child_process( struct server *serp )
24 signals_pending[0] = -1;
25 signals_pending[1] = -1;
26
27- Sclose(0);
28- Sclose(1);
29- Sclose(2);
30+ if ( ( null_fd = open( "/dev/null", O_RDONLY ) ) == -1 )
31+ {
32+ msg( LOG_ERR, func, "open('/dev/null') failed: %m") ;
33+ _exit( 1 ) ;
34+ }
35+
36+ for ( fd = 0 ; fd <= MAX_PASS_FD ; fd++ )
37+ {
38+ if ( fd != null_fd && dup2( null_fd, fd ) == -1 )
39+ {
40+ msg( LOG_ERR, func, "dup2(%d, %d) failed: %m") ;
41+ _exit( 1 ) ;
42+ }
43+ }
44+ if ( null_fd > MAX_PASS_FD )
45+ (void) Sclose( null_fd ) ;
46
47
48 #ifdef DEBUG_SERVER
49diff --git a/xinetd/service.c b/xinetd/service.c
50index 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,
54 return FAILED;
55
56 if ( last == NULL ) {
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) );
61 }
62
63 (void) time( &current_time ) ;
64@@ -772,8 +772,8 @@ static status_e failed_service(struct service *sp,
65 return FAILED;
66
67 if( last == NULL ) {
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));
72 }
73
74 (void) time( &current_time ) ;
75--
761.5.3.6.2040.g15e6
77